Service Bus Queue
  • 13 Dec 2022
  • 5 Minutes to read
  • Contributors
  • Dark
    Light
  • PDF

Service Bus Queue

  • Dark
    Light
  • PDF

Article Summary

Introduction

Service Bus is a messaging service provided by Azure to interconnect applications and services running within a cloud or on-premises solution. It is therefore a component available in any cloud architecture built with Azure.

The Service Bus Queue provides one-to-one communication between the applications. Cerebrata supports the following operations on the Service Bus Queue.

View Messages

One of the major challenges in Service Bus is viewing the messages in the queues. Cerebrata solves this challenge by allowing the users to view both the active and dead-letter messages in the queue. The messages can be viewed either in peek mode or peek lock mode.

The below illustration shows viewing the messages in a queue.
Queue-Active-Peek

Peek messages by Sequence Number

When there are multiple messages in a queue, there may be a need to peek at the messages from a particular sequence number. This can be achieved in Cerebrata by at the peeking the messages from the required sequence number.

The below illustration shows peeking at the messages from the given sequence number in a queue.
Queue-Peek-by-sequence-number

Filter messages by Dead-Letter reason

Messages in the queue can be dead-lettered due to multiple reasons. Cerebrata helps us in filtering the received messages based on the dead-letter reason.
The below illustration shows filtering the messages in a dead-letter queue based on the dead-letter reason.
Queue-filter-DL-message

Resubmit messages

Messages in queue may get dead-lettered due to multiple reason based on the use cases. So, there will be a need to reprocess the messages that are in the dead-letter queue by resubmitting them. Cerebrata helps in reprocessing the messages by resubmitting the messages to the same queue or any other queue or topic in the same namespace to which the source queue belongs.
The below illustration shows the resubmission of messages from a queue.

Queue-resubmit-messages

Modify and resubmit the message

Cerebrata also helps us in modifying the message content along with its properties like custom properties based on the data types, label, and resubmitting it to the same queue. The original message can also be deleted if the message is received in peek-lock mode.
The below illustration shows the modification and resubmission of messages in a queue.

Messages received with date time custom properties will appear as an epoch timestamp value.

ModifyandResubmit

Unlock and Renew the lock

The time taken to process the messages vary based on the scenario. So, it may be required to renew the lock of some messages so that you can have some additional time to process those messages. There may be cases, the message can be unlocked even before its lock gets expired. Cerebrata helps us in performing the above operations with ease.
The below illustration shows how to renew the lock and unlock the messages received in peek-lock mode.

Queue-renew-lock and unlock-messages

Delete messages

Messages can also be deleted from Service Bus Queue when the messages are received in peek-lock mode. This operation will be useful when there are more invalid messages in the dead-letter end of the queue.
The below illustration shows how to delete the messages received in peek-lock mode.

Queue-delete-message

Add messages

In most cases of initial development, there will not be any upstream application to send the messages to the Service Bus Queue. We need to write custom code to send the messages. Cerebrata eliminates this need for custom code by allowing us to send messages with required custom properties based on the data types, message content, and enqueued time. It is also possible to set the batch size. For example, we can send 100 messages with a batch size of 20 and a Think time of 1000 ms, so that 20 messages will be sent in 5 batches at an interval of 1000 ms between each batch.
The below illustration shows how to send messages to a queue.

Messages received with date time custom properties will appear as an epoch timestamp value.

Addmessage

Purge messages

It is also possible to delete all the active and dead-letter messages in the Queue based on our business requirements.
The below illustration shows how to purge the messages in a queue.

Queue-purge-message

Monitor queue

Cerebrata helps us in visualizing the behavior of applications sending and receiving messages from the queue in real-time through Monitor. It is also possible to configure the refresh frequency so that the data shown is more realistic.
The below illustration shows how to monitor the messages in a queue.

Queue-monitor

Add Queue

As a first step in developing a Cloud architecture, it is often necessary to create Queues with different properties to implement the required functionalities. Cerebrata makes this possible.

Service Bus Queues can be created with properties such as Requires Session, Enable Express, Enable Batch operations, Enable Message Ordering, Enable Requires Duplicate Detection, etc.

The below illustration shows adding a Service Bus Queue with the required properties.

Add-Queue

View Properties

It can be difficult to remember the properties of a Queue when there are multiple queues in a Namespace with different properties. Cerebrata allows us to view the properties of a Queue in order to overcome the above challenge.

The below illustration shows how to view the properties of a Queue.

Queue-Properties

View Message count

In a queue, messages can be active, dead-letter, transferred, or scheduled. Cerebrata helps us visualize the message count in a queue to get a better understanding of the messages in the queue.

The below illustration shows how to view the count of messages in a Queue.

Queue-Message-Count

Update Queue

It is common to update certain properties of the Queue like the max delivery count of the messages, the destination for auto-forwarding active messages, and the destination for auto-forwarding dead-letter messages. Cerebrata helps us in updating the queue properties at ease at any time.

The below illustration shows how to edit the properties of a Queue.

Queue-Update-Properties

Update Status

In some cases, the application may not receive messages from the Queue for some reason. In such cases, it is important to stop sending messages to the Queue. This can be done by setting the status of the Queue to SendDisabled. Similarly, the status of the Queue can also be set to ReceiveDisabled.

The below illustration shows how to edit the status of a Queue.

Queue-Update-Status

Delete Queue

It is also necessary to delete the queues that are of no use in the namespace to prevent the unwanted cost incurred due to the messages in them.

The below illustration shows how to delete a Queue.

Queue-Delete


Was this article helpful?