Skip to content

Enterprise Integration Patterns with Service Bus (Part 2)

January 11, 2013

Priority-Queues

The scenario here is that a receiver is interested in receiving messages in order of priority for a single or multiple senders. A common use cases for this is event notification, where critical alerts need to be processed first. Today Service Bus Queues do not have the capability to internally sort messages by priority but we can achieve this pattern using Topics and Subscriptions.

We achieve this scenario by routing messages with different priorities to different subscriptions. Routing is done based on the Priority property that the sender adds to the message. The recipient processes messages from specific subscriptions and thus achieves the desired priority order of processing.

The Service Bus implementation for this is thru use of SQL Rules on Subscriptions. These Rules contain Filters that are applied on the properties of the message and determine if a particular message is relevant to that Subscription.

Service Bus Features used:

1. SQL Filters can specify Rules in SQL 92 syntax

2. Typically Subscriptions have one Rule but multiple can be applied

3. Rules can contain Actions that may modify the message (in that case a copy
of the message is created by each Rule that modifies it)

4. Actions can be specified in SQL 92 syntax too.

 

The code sample for this is available here.

3 Comments
  1. How to send more than 100 brokered messages to Azure Service Bus within a Transaction?

Leave a Reply to diogo Cancel reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: