Azure Service Bus + Sessions

Service Bus queues and subscriptions provide support for requiring sessions when receiving messages. Sessions are useful in a number of scenarios where a group of messages are to be grouped together, such as all the items in an order, or when a large document has been split into smaller messages. Sessions are especially useful when an application has load balanced receivers as they ensure that all messages in the same session are received by the same instance of the receiving application.

In order to work with sessions the queue or subscription must be created with the RequiresSession property set to true. Messages sent to the queues and topics that contain session aware subscriptions must have a value set for their SessionId properties. When receiving messages from session aware queues and subscriptions a MessageSession must be used instead of a QueueClient or SubscriptionClient.

Sessions are extremely important, because they allow the receiver to determine whether all the messages that belong to a specific logical group have arrived.

Advertisements

Leave a 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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s