Edit

Share via


RabbitMQ bindings for Azure Functions overview

Azure Functions integrates with RabbitMQ via triggers and bindings.

Note

The RabbitMQ bindings are only fully supported on Elastic Premium and Dedicated (App Service) plans. Flex Consumption and Consumption plans aren't yet supported.

RabbitMQ bindings aren't supported by the Azure Functions v1.x runtime.

The Azure Functions RabbitMQ extension allows you to send and receive messages using the RabbitMQ API with Functions.

Action Type
Run a function when a RabbitMQ message comes through the queue Trigger
Send RabbitMQ messages Output binding

Prerequisites

Before working with the RabbitMQ extension, you must set up your RabbitMQ endpoint. To learn more about RabbitMQ, see the getting started page.

Install extension

The extension NuGet package you install depends on the C# mode you're using in your function app:

Functions execute in an isolated C# worker process. To learn more, see Guide for running C# Azure Functions in an isolated worker process.

Add the extension to your project by installing this NuGet package.

Install bundle

To be able to use this binding extension in your app, make sure that the host.json file in the root of your project contains this extensionBundle reference:

{
    "version": "2.0",
    "extensionBundle": {
        "id": "Microsoft.Azure.Functions.ExtensionBundle",
        "version": "[4.0.0, 5.0.0)"
    }
}

In this example, the version value of [4.0.0, 5.0.0) instructs the Functions host to use a bundle version that is at least 4.0.0 but less than 5.0.0, which includes all potential versions of 4.x. This notation effectively maintains your app on the latest available minor version of the v4.x extension bundle.

When possible, you should use the latest extension bundle major version and allow the runtime to automatically maintain the latest minor version. You can view the contents of the latest bundle on the extension bundles release page.

If your app requires you to use a previous extension version, you might need to instead specify a previous bundle version. You can review the bundle releases to locate a bundle that contains a version of this extension that can be used by your app. For more information, see Azure Functions extension bundles. ::: zone-end

host.json settings

This section describes the configuration settings available for this binding in version 2.x and later. Settings in the host.json file apply to all functions in a function app instance. For more information about function app configuration settings, see host.json reference for Azure Functions.

{
    "version": "2.0",
    "extensions": {
        "rabbitMQ": {
            "prefetchCount": 100,
            "queueName": "queue",
            "connectionString": "%<MyConnectionAppSetting>%",
            "port": 10
        }
    }
}
Property Default Description
prefetchCount 30 Gets or sets the number of messages that the message receiver can simultaneously request and is cached.
queueName n/a Name of the queue to receive messages from.
connectionString n/a The RabbitMQ message queue connection string. The connection string is directly specified here and not through an app setting.
port 0 (ignored if using connectionString) Gets or sets the Port used. Defaults to 0, which points to rabbitmq client's default port setting: 5672.