Azure WebJobs and RabbitMQ

As I am working on a project that leverages RabbitMQ and Azure WebJobs. I needed to write webjob functions that are triggered by a message on a queue in RabbitMQ.

While searching around, I have not found an extension that integrates with Azure WebJobs in a nice way and that is how WebJobs.Extensions.RabbitMQ was born.

The library exposes 3 attributes.

RabbitQueueTriggerAttribute: this attribute will subscribe to the queue and triggers whenever a message arrives.

RabbitQueueBinderAttribute: this attribute extends RabbitQueueTriggerAttribute to allow for dynamic creation of the queue and bind it to the exchange.
[RabbitQueueBinder("exchangeName", "routingKey", "errorExchangeName(optional)","autoDelete=false(optional)","durable=true(optional)","exclusive=false(optional)")]

RabbitMessageAttribute: this attribute allows you to publish a message to an exchange.


Example of subscription example:

public void IntegrateApprovedProductToMarketPlace(
[RabbitQueueBinder("product", "product.approved", "error")]
ProductApproved message, TextWriter log)
[handle message here]

Example of a publisher:

public void ProcessBulkOrders([some trigger],
out OrderProcessed message, TextWriter log)
[assign message value here]

The code is available on GitHub and Nuget



No comments yet.

Leave a Reply