com.microsoft.azure.functions.annotation.ServiceBusTopicTrigger Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-functions-java-library Show documentation
Show all versions of azure-functions-java-library Show documentation
This package contains all Java interfaces and annotations to interact with Microsoft Azure functions runtime.
/**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*/
package com.microsoft.azure.functions.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
*
* Place this on a parameter whose value would come from Service Bus topic, and causing the method
* to run when a new item is published. The parameter type can be one of the following:
*
*
*
* - Any native Java types such as int, String, byte[]
* - Nullable values using Optional<T>
* - Any POJO type
*
*
*
* The following example shows a service bus topic trigger which logs the message:
*
*
*
* {@literal @}FunctionName("sbprocessor")
* public void serviceBusProcess(
* {@literal @}ServiceBusTopicTrigger(name = "msg",
* topicName = "mytopicname",
* subscriptionName = "mysubname",
* connection = "myconnvarname") String message,
* final ExecutionContext context
* ) {
* context.getLogger().info(message);
* }
*
*
* @since 1.0.0
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.PARAMETER)
public @interface ServiceBusTopicTrigger {
/**
* The variable name used in function.json.
*
* @return The variable name used in function.json.
*/
String name();
/**
*
* Defines how Functions runtime should treat the parameter value. Possible values are:
*
*
* - "": get the value as a string, and try to deserialize to actual parameter type like
* POJO
* - string: always get the value as a string
* - binary: get the value as a binary data, and try to deserialize to actual parameter type
* byte[]
*
*
* @return The dataType which will be used by the Functions runtime.
*/
String dataType() default "";
/**
* Defines the name of the Service Bus topic to which to bind.
*
* @return The Service Bus topic name string.
*/
String topicName();
/**
* Defines the subscription name of the Service Bus topic to which to bind.
*
* @return The Service Bus topic subscription name string.
*/
String subscriptionName();
/**
* Defines the app setting name that contains the Service Bus connection string.
*
* @return The app setting name of the connection string.
*/
String connection();
/**
* Defines the permission of the Service Bus topic to which to bind.
*
* @return The Service Bus topic permission.
*/
AccessRights access() default AccessRights.MANAGE;
/**
* Defines the value indicating whether the sessions are enabled.
* @return The value indicating whether the sessions are enabled.
*/
boolean isSessionsEnabled() default false;
/**
* Cardinality of the trigger input.
* Choose 'One' if the input is a single message or 'Many' if the input is an array of messages.
* 'ONE' is the default if unspecified
* @return An {@link Cardinality} value representing the Cardinality
*/
Cardinality cardinality() default Cardinality.ONE;
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy