Decoupled Architecture and Azure Queues


Decoupled Architecture and Azure Queues Feature

This article will introduce the concept of decoupling between application components using Azure queues. Before going with decoupled architecture with can consider the pros and cons of tightly coupled architecture.

Tightly coupled architecture

If all the components in a single application are tightly connected, then each component will wait for the result. So any single error can throw all the requests away.

Coupled architecture to Decoupled Architecture

In the preceding diagram you can see the traditional web application. There is a front end, that receives the user inputs and forwards the request business layer after some validation. The business layers then ends up querying the database and responses are then propagated back to the front end. What happens when one of the requests times out because of any database failure ? In this case the application throws an error and is presented to the user. The each application component works together to serve the request. The tightly coupling has two main advantages over the less coupled. It is simpler to understand and debug the code. The second advantage is the tight coupling makes the calls between the components faster.
Now you have seen the problem with tightly coupled architecture , so what is the alternative way ? Alternative is the decoupled architecture.

Decoupled Architecture

This is just decouple the individual component from on another in an application. However, we will be able to communicate each component and get responses for our requests. Basically queues are the best component to achieve this. The application components named producers that create message and deliver them to a message queue. Other application components called consumers are connected to the queue and get the messages to be processed. Messages placed into the queue are stored until the consumer retrieves them. If the processing component fails, the unprocessed messages are still in the queue and will be processed by a backup or an extra component. Message queue provides an asynchronous communication protocol. Email is the best example for asynchronous communication.

Azure offers Azure storage queues and Azure service bus queues. We can us any of these based on the requirement.

Azure Storage Queues

  • Azure storage queues are parts of the Azure storage service, together with Table and BLOB storage.
  • It contains messages up to 64 KB , additional data can be stored in Table or BLOB storage.
  • Azure Service Bus

  • That are parts of Service Bus , allows high level brokered messaging infrastructure
  • It contains messages up to 256 KB
  • It supports local transaction
  • Guaranteed order (FIFO)
  • Azure Federated Security for authorization.
  • You will get detailed comparison between Azure Storage Queues and Azure Service Bus from Azure website.

    See Also

  • Azure Service Bus Queue Sample Implementation
  • The following two tabs change content below.

    Tom Mohan

    Tom Mohan is a technologist who loves to code and build. He enjoys working on Microsoft Technologies. Tom specializes in ASP.NET MVC, Web API , Azure, C# ,WPF, SQL etc and holds a Bachelor engineering degree in Computer Science. Certification : MCSD , MCTS

    Latest posts by Tom Mohan (see all)