Azure ServiceBus
Trigger a function with messages posted to a Azure ServiceBus queue.
The Azure ServiceBus source polls a ServiceBus queue for messages and transforms them into inputs for fns. If the fn returns a successful value, the source will mark the message as complete. Otherwise, the source will abandon the message. The message may be re-queued depending on the queue’s policy.
fnrunner Key
fnrun.source/azure/servicebus
Configuration
The following table describes the keys on the configuration object for the Azure ServiceBus source.
Key | Type | Default | Description |
---|---|---|---|
connectionString | String | "" | The connection string for the ServiceBus namespace. |
queueName | String | "" | The name of the queue. |
isDeadLetterReceiver | Boolean | false | Indicates whether the source should read from the queue’s DLQ. |
autoRenewLockInterval | Duration | 0s | The rate at which the message lock should be renewed. |
Inputs
Inputs generated by the Azure ServiceBus source are objects with the following keys.
Key | Type | Description |
---|---|---|
ContentType | String | The content type of the message data. |
Data | String | The message contents. |
Examples
The following configuration defines a system that polls a queue named my-queue
for messages and posts each message to an external http endpoint. If the
endpoint returns with a successful value (a 200- or 300-level status code), then
the message will be deleted from the system. Otherwise, the message will become
available again after the visibility timeout expires. The connection string is
defined as an environment variable. The message lock will be renewed every 15
seconds until the message is processed.
source:
fnrun.source/azure/servicebus:
connectionString: $SERVICEBUS_CONNECTION_STRING
queueName: my-queue
autoRenewLockInterval: 15s
middleware:
- fnrun.middleware/key: Data
fn:
fnrun.fn/http:
targetURL: http://example.com/some-endpoint