We are happy to share that Azure Service Bus is now able to send events to Azure Event Grid. The key scenario this feature enables is for Service Bus queues, topics, or subscriptions with low message volumes to not require a receiver to be polling for messages at all times. Service Bus will now send events to Azure Event Grid when there are messages in a queue if no receivers are present. You can create Azure Event Grid subscriptions for your Service Bus namespaces, listen to these events, and react to the events by starting a receiver. With this feature, Service Bus can be used in reactive programming models.
Today, Azure Service Bus sends events for two scenarios:
- Active messages with no listeners available
- Deadletter messages available
Additionally, it uses the standard Azure Event Grid security and authentication mechanisms.
How often and how many events are emitted?
If you have multiple queues and topics/subscriptions in the namespace, you get at least one event per queue and subscription. The events are immediately emitted if there are no messages in the Service Bus entity and a new message arrives, or every two minutes unless Azure Service Bus detects an active receiver. Message browsing does not interrupt the events.
By default Azure Service Bus emits events for all entities in the namespace. If you want to get events for specific entities only, see the following filtering section.
Filtering, limiting from where you get events
If you want to get events from only one queue or one subscription within your namespace, you can use the "Begins with" or "Ends with" filters provided by Azure Event Grid. In some interfaces, the filters are called “Pre” and “Suffix” filters. If you want to get events for multiple, but not all queues and subscriptions, you can create multiple Azure Event Grid subscriptions and provide a filter for each.
In the current release, this feature is only for Premium namespaces and is available in all Event Grid regions. We will add support for Standard namespaces at a later point in time.