Skip Navigation LinksAzure Developers Guide > Azure Service Bus > Brokered Messaging > Brokered Messaging Features & Patterns > Message Sessions Example > Creating a Session Aware Queue

Training Courses

All course material is in English, and courses are delivered in English. Feel free to contact me for further information. cloudcasts.net@gmail.com

Creating a Session Aware Queue

The first stage is to delete and re-create the RFID checkout queue so that it requires messages to be sent in sessions. The following code modification in the checkout console will create the queue with the RequiresSession property set to true.

 

// Create a queue with duplicate detection

// with a detection history window of one hour,

// and requires sessions.

QueueDescription rfidCheckoutQueueDescription =

    new QueueDescription("rfidcheckout")

    {

        RequiresSession = true,

        RequiresDuplicateDetection = true,

        DuplicateDetectionHistoryTimeWindow = new TimeSpan(0, 1, 0)

    };

 

// Create a queue that supports duplicate detection.

namespaceMgr.CreateQueue(rfidCheckoutQueueDescription);

 

 

When this is done messages sent to the queue must have a valid value set for the SessionId, and must be received using a MessageSession instead of a QueueClient.

Speaking Engagements