Show / Hide Table of Contents

Class ServiceBusTriggerAttribute

Attribute used to bind a parameter to a ServiceBus Queue message, causing the function to run when a message is enqueued.

Inheritance
System.Attribute
ServiceBusTriggerAttribute
Namespace: System.Dynamic.ExpandoObject
Assembly: Microsoft.Azure.WebJobs.Extensions.ServiceBus.dll
Syntax
[Microsoft.Azure.WebJobs.ConnectionProvider(typeof(Microsoft.Azure.WebJobs.ServiceBusAccountAttribute))]
[Microsoft.Azure.WebJobs.Description.Binding]
[System.AttributeUsage(System.AttributeTargets.Parameter)]
[System.Diagnostics.DebuggerDisplay("{DebuggerDisplay,nq}")]
public sealed class ServiceBusTriggerAttribute : Attribute, Microsoft.Azure.WebJobs.IConnectionProvider
Remarks

The method parameter type can be one of the following:

  • Azure.Messaging.ServiceBus.ServiceBusReceivedMessage
  • System.String
  • System.Bytearray
  • System.BinaryData
  • A user-defined type (serialized as JSON)

Constructors

ServiceBusTriggerAttribute(String)

Initializes a new instance of the ServiceBusTriggerAttribute class.

Declaration
public ServiceBusTriggerAttribute (string queueName);
Parameters
System.String queueName

The name of the queue to which to bind.

ServiceBusTriggerAttribute(String, String)

Initializes a new instance of the ServiceBusTriggerAttribute class.

Declaration
public ServiceBusTriggerAttribute (string topicName, string subscriptionName);
Parameters
System.String topicName

The name of the topic to bind to.

System.String subscriptionName

The name of the subscription in topicName to bind to.

Properties

AutoCompleteMessages

Gets or sets a value indicating whether trigger should automatically complete the message after successful processing. If not explicitly set, the behavior will be based on the AutoCompleteMessages value.

Declaration
public bool AutoCompleteMessages { get; set; }
Property Value
System.Boolean

Connection

Gets or sets the app setting name that contains the Service Bus connection string.

Declaration
public string Connection { get; set; }
Property Value
System.String

IsSessionsEnabled

Gets or sets a value indicating whether sessions are enabled.

Declaration
public bool IsSessionsEnabled { get; set; }
Property Value
System.Boolean

MaxMessageBatchSize

Gets or sets the maximum number of messages that will be passed to each function call. This only applies for functions that receive a batch of messages.

Declaration
public int MaxMessageBatchSize { get; set; }
Property Value
System.Int32

QueueName

Gets the name of the queue to bind to.

Declaration
public string QueueName { get; }
Property Value
System.String

Remarks

When binding to a subscription in a topic, returns null.

SubscriptionName

Gets the name of the subscription in TopicName to bind to.

Declaration
public string SubscriptionName { get; }
Property Value
System.String

Remarks

When binding to a queue, returns null.

TopicName

Gets the name of the topic to bind to.

Declaration
public string TopicName { get; }
Property Value
System.String

Remarks

When binding to a queue, returns null.

Back to top Azure SDK for .NET