in azure/functions/decorators/function_app.py [0:0]
def service_bus_topic_trigger(
self,
arg_name: str,
connection: str,
topic_name: str,
subscription_name: str,
data_type: Optional[Union[DataType, str]] = None,
access_rights: Optional[Union[AccessRights, str]] = None,
is_sessions_enabled: Optional[bool] = None,
cardinality: Optional[Union[Cardinality, str]] = None,
**kwargs: Any) -> Callable[..., Any]:
"""The on_service_bus_topic_change decorator adds
:class:`ServiceBusTopicTrigger` to the :class:`FunctionBuilder` object
for building :class:`Function` object used in worker function
indexing model. This is equivalent to defining ServiceBusTopicTrigger
in the function.json which enables function to be triggered when new
message(s) are sent to the service bus topic.
All optional fields will be given default value by function host when
they are parsed by function host.
Ref: https://aka.ms/azure-function-binding-service-bus
:param arg_name: The name of the variable that represents the
:class:`ServiceBusMessage` object in function code.
:param connection: The name of an app setting or setting collection
that specifies how to connect to Service Bus.
:param topic_name: Name of the topic to monitor.
:param subscription_name: Name of the subscription to monitor.
:param data_type: Defines how Functions runtime should treat the
parameter value.
:param access_rights: Access rights for the connection string.
:param is_sessions_enabled: True if connecting to a session-aware
queue or subscription.
:param cardinality: Set to many in order to enable batching.
:return: Decorator function.
"""
@self._configure_function_builder
def wrap(fb):
def decorator():
fb.add_trigger(
trigger=ServiceBusTopicTrigger(
name=arg_name,
connection=connection,
topic_name=topic_name,
subscription_name=subscription_name,
data_type=parse_singular_param_to_enum(data_type,
DataType),
access_rights=parse_singular_param_to_enum(
access_rights,
AccessRights),
is_sessions_enabled=is_sessions_enabled,
cardinality=parse_singular_param_to_enum(cardinality,
Cardinality),
**kwargs))
return fb
return decorator()
return wrap