| author | mattchenderson |
|---|---|
| ms.service | azure-functions |
| ms.topic | include |
| ms.date | 07/10/2023 |
| ms.author | mahender |
When you want the function to process a single message, the Service Bus trigger can bind to the following types:
| Type | Description |
|---|---|
string |
The message as a string. Use when the message is simple text. |
byte[] |
The bytes of the message. |
| JSON serializable types | When an event contains JSON data, Functions tries to deserialize the JSON data into a plain-old CLR object (POCO) type. |
| ServiceBusReceivedMessage1 | The message object. When binding to ServiceBusReceivedMessage, you can optionally also include a parameter of type ServiceBusMessageActions1,2 to perform message settlement actions. |
When you want the function to process a batch of messages, the Service Bus trigger can bind to the following types:
| Type | Description |
|---|---|
T[] where T is one of the single message types |
An array of events from the batch. Each entry represents one event. When binding to ServiceBusReceivedMessage[], you can optionally also include a parameter of type ServiceBusMessageActions1,2 to perform message settlement actions. |
1 To use these types, you need to reference Microsoft.Azure.Functions.Worker.Extensions.ServiceBus 5.14.1 or later and the common dependencies for SDK type bindings.
2 When using ServiceBusMessageActions, set the AutoCompleteMessages property of the trigger attribute to false. This prevents the runtime from attempting to complete messages after a successful function invocation.