Respond to Service Bus Events
  • Updated on 27 Jun 2019
  • 1 minute to read
  • Contributors
  • Print
  • Comments
  • Share
  • Dark
    Light

Respond to Service Bus Events

  • Print
  • Comments
  • Share
  • Dark
    Light

#ServerlessTips - Azure Event Grid
Author: Steef-Jan Wiggers Azure MVP

The concept of Event Grid is simple; there are event sources pushing events, and there are subscribers interested in individual events, which handle them accordingly. Event Grid can manage multiple publishers and subscribers (event handlers) and sits as a mediator between them. Hence there decoupled and have no dependencies with other.
Respond to Service Bus events  1.png

Image Source

One of the event sources can be a Service Bus Namespace (Premium SKU only), consisting of queues. Subsequently, you can subscribe to active messages on a queue with no listeners. A Logic App can subscribe to these events and handle them through a workflow.

You create a Logic App and select the template for Azure Event Grid. Next, you configure the trigger by connecting to your subscription, select the resource type, resource name and the event type.
Respond to Service Bus events  2.png

Once you have set the trigger action in the Logic App and save it, a subscription will be visible in the events blade of the service bus namespace.

When you send a message to a queue, an event will be raised and pushed to the Logic App (subscriber). Within the Logic App, you can follow up the trigger by getting messages from a queue using peek-lock. Next, you handle each message and complete the message.

Respond to Service Bus events  3.png

The benefit of using Event Grid with a service bus queue in a Logic App is that instead of polling, you only pull messages from the queue when there is a trigger – hence no long polling that happens with the Service Bus connector.
Was this article helpful?