Let's brainstorm ourselves with ABS : Azure Service Bus

Let's brainstorm ourselves with ABS : Azure Service Bus

ASB is a cloud messaging service with multi-tenant capabilities, which holds a strong place in establishing communication between applications and services. The asynchronous way of handling the communications provides an flexible, structured FIFO messaging system, with a set of publish/subscribe capabilities.

Deep Dive

Microsoft Azure Service Bus is an enterprise managed integration service, which is most commonly used to decouple applications and services and provide a reliable and secure gateway to perform asynchronous data/state transfer.

If we talk about data transfer, it is transferred between different applications and services using messages. A message is in a binary format which can contain JSON, XML, or plain text.

Some most commonly used messaging scenarios are,

Messaging: Transfer business data i.e. sales, purchase orders, journals, or inventory movements

Decouple Applications: Improve reliability and scalability of applications and services

Topics & Subscriptions: Enable 1:n relationships between publishers and subscribers

Message Sessions: Implement workflows that require message ordering or message deferral

Namespaces A namespace is treated as a scoping container or an application container for all the messaging components. A single namespace can contain multiple queues and topics.

Queues For every messaging service provider, Queue acts as the building block for the communication to take place. All the messages are inserted into queues and outbound through the same on FIFO basis. A queue enables you to store messages until the receiving application is available to intake the messages and process them.

11.PNG

Topics Topics are the alternate approach to send and receive messages. A basic difference can be stated as – A queue is used for point-to-point communication, while the topics are useful in publish/subscribe scenarios.

22.PNG

Topics can have independent and multiple subscriptions. A subscriber to a topic can receive a copy of each message sent to that topic i.e. a BCC. Subscriptions are also known as named entities, which are durably created but can optionally expire or auto-delete.

Depending on the scenarios, you may not want individual subscriptions to receive all messages sent to a topic, if that’s the case then you can use rules and filters to define conditions that can trigger optional actions like filter specified messages and set or modify message properties.

Advanced features

Service Bus also has an advanced set of features that enable you to solve more complex messaging problems as depicted below,

Message sessions To guarantee a first-in, first-out (FIFO) approach in Service Bus, use sessions. Sessions enable joint and ordered handling of unbounded sequences of related messages.

Auto-forwarding

This feature enables you to chain a queue or subscription to another queue or topic that is a part of the same namespace. When auto-forwarding is enabled, Service Bus automatically removes messages that are placed in the first queue or subscription (source) and puts them in the second queue or topic (destination).

Dead-lettering

ASB also supports a dead-letter queue (DLQ) to hold messages that cannot be delivered to any receiver, or messages that cannot be processed. You can then remove messages from the DLQ and inspect them.

Scheduled delivery

This feature enables you to process the messages on a scheduled basis i.e. by scheduling a job.

Message deferral

When a queue or subscription client receives a message that it is to be processed, but processing is not currently possible due to some special circumstances within the application, then the entity has the option to defer retrieval of the message to a later point. The message remains in the queue or subscription, but it is set aside.

Batching

Client-side batch processing enables a queue or topic client to delay sending a message for a certain period of time. If the client sends additional messages during this time period, it transmits the messages in a single batch.

Transactions

A transaction groups two or more operations together into an execution scope. Service Bus supports grouping operations against a single messaging entity (queue, topic, subscription) within the scope of a transaction.

Filtering and actions

Subscribers can define which messages they want to receive from a topic. These messages are specified in the form of one or more named subscription rules. For each matching rule condition, the subscription produces a copy of the message, which may be differently annotated for each matching rule.

Auto-delete on idle

This feature enables you to specify an idle interval after which the queue is automatically deleted. The minimum duration is 5 minutes.

Duplicate detection

This can be considered as the most important feature. If an error occurs that causes the client to have any doubt about the outcome of a send operation, duplicate detection takes the doubt out of these situations by enabling the sender to resend the same message, and the queue or topic discards any duplicate copies.

Did you find this article valuable?

Support AJ’s Blog by becoming a sponsor. Any amount is appreciated!