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.

KeyTypeDefaultDescription
connectionStringString""The connection string for the ServiceBus namespace.
queueNameString""The name of the queue.
isDeadLetterReceiverBooleanfalseIndicates whether the source should read from the queue’s DLQ.
autoRenewLockIntervalDuration0sThe rate at which the message lock should be renewed.

Inputs

Inputs generated by the Azure ServiceBus source are objects with the following keys.

KeyTypeDescription
ContentTypeStringThe content type of the message data.
DataStringThe 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

Edit this page on GitHub