Skip to main content

Service Bus Queues from Windows Azure - Business Scenarios

In the last month I talked about Service Bus Queue in a lot of blog posts. Let’s see some scenarios when we can use Service Bus Queues with success.

The first scenario can came from the world of hyper-markets, where we can have 50,60 or 70 cash machine. As a manager I’m interested to know the stock of my products all around the country. Based on this I can move goods from one deposit to another, or from a hyper-market to another. I don’t want to see the stock in real-time. A delay of 5-10 minutes is acceptable, but is very important for me to not lose items that are sold (I need to see the real-stock and not some estimations). Also even if this information is very important for me, I don’t want to invest a lot of money in an application and on servers that need to be maintained.
For this case, we can imagine a solution that use for communication Service Bus Queue. The cash machine sends to the queue the list of products that were sold. A central server has all the time from the world to consume products list and update the stocks. If we have a rush hour is not a problem for us because all the messages will be process in the end, without losing any messages. But what about holidays, for example Christmas, when is very important to know the stock in real time (we don’t want to be out of soda or sugar in December 22th. In this case we can scale and add more servers on the consumer side. If we are on Windows Azure with this then this is piece of cake.
Another interesting solution here is to use WCF and Service Bus Queue. In this way we will not rely on Windows Azure Services and it will be very easy to move from cloud to on-premises or to integrate another solution.

The second scenario put us in the educational system. We need to create a system that is able to centralize all the grades of students at the end of each trimester. Teachers can add data to this system in any moment of time, but because we need this information only at the end of trimester we don’t want to waste money on a server/s that run all the time to permit teachers to add this data. Also we should be able to store them until the end of trimester when we centralize them.
For this case, it would be very easily to create an application that sends this data to the queue. Because the TTL of a message from Service Bus Queue can be unlimited, we can persist this data very easily (and cheap). At the end of the trimester we can start a machine that consumes this data generating an output and creating an archive.
One great idea here. We can create a Metro Application for a Windows 8 Tablet where teacher can add this data. From the tablet the data is send directly to the queue. Because we have ACS claims and role-based access control on Service Bus Queue, all 3 of AAA can be satisfied.

In the last scenario we have a big restaurant chain that makes delivery at home. We want to be able to process the commands in the order that were submitted, we don’t want to lose any message.
For this scenario we can create a Service Bus namespace and create a queue for each work point. Based on the address from where the command is submitted we can add the command to the most appropriate restaurant. Service Bus Queue guarantees that each message will be processed in the order that he was added to the queue and also we will not lose any messages (this is a scenario where Service Bus Topics can be used with success also – but we will talk with another occasion).

What is important to know about Service Bus Queues?
Service Bus Queues can be a great solution when we want:
  • Loose coupling (consumer and producer don’t need to know each other – upgrades or changing one of the part can be made very easily)
  • Load leveling (we don’t have to run the consumer all the time)
  • Load balancing (we can add consumers or producer very easily)
  • Temporary decoupling (producer or consumer can be offline)
I hope this example made you to imagine some cases when Service Bus Queues can be our best friend and maybe you will use it or take into account for the next project.


  1. What I would be interested to find out: what are the differences between Azure service bus queues and Azure queue service.

    1. You can find the response in an older post wrote by me:


Post a Comment

Popular posts from this blog

ADO.NET provider with invariant name 'System.Data.SqlClient' could not be loaded

Today blog post will be started with the following error when running DB tests on the CI machine:
threw exception: System.InvalidOperationException: The Entity Framework provider type 'System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer' registered in the application config file for the ADO.NET provider with invariant name 'System.Data.SqlClient' could not be loaded. Make sure that the assembly-qualified name is used and that the assembly is available to the running application. See for more information. at System.Data.Entity.Infrastructure.DependencyResolution.ProviderServicesFactory.GetInstance(String providerTypeName, String providerInvariantName) This error happened only on the Continuous Integration machine. On the devs machines, everything has fine. The classic problem – on my machine it’s working. The CI has the following configuration:

TeamCity.NET 4.51EF 6.0.2VS2013
It seems that there …

How to check in AngularJS if a service was register or not

There are cases when you need to check in a service or a controller was register in AngularJS.
For example a valid use case is when you have the same implementation running on multiple application. In this case, you may want to intercept the HTTP provider and add a custom step there. This step don’t needs to run on all the application, only in the one where the service exist and register.
A solution for this case would be to have a flag in the configuration that specify this. In the core you would have an IF that would check the value of this flag.
Another solution is to check if a specific service was register in AngularJS or not. If the service was register that you would execute your own logic.
To check if a service was register or not in AngularJS container you need to call the ‘has’ method of ‘inhector’. It will return TRUE if the service was register.
if ($injector.has('httpInterceptorService')) { $httpProvider.interceptors.push('httpInterceptorService&#…

Fundamental Books of a Software Engineer (version 2018)

More then six years ago I wrote a blog post about fundamental books that any software engineer (developer) should read. Now it is an excellent time to update this list with new entries.

There are 5 different categories of books, that represent the recommended path. For example, you start with Coding books, after that, you read books about Programming, Design and so on.
There are some books about C++ that I recommend not because you shall know C++, only because the concepts that you can learn from it.


Writing solid codeCode completeProgramming Pearls, more programming pearls(recommended)[NEW] Introduction to Algorithms


Refactoring (M. Fowler)Pragmatic ProgrammerClean code[NEW] Software Engineering: A Practitioner's Approach[NEW] The Mythical Man-Month[NEW] The Art of Computer Programming


Applying UML and Patterns (GRASP patterns)C++ coding standards (Sutter, Alexandrescu)The C++ programming language (Stroustrup, Part IV)Object-oriented programming (Peter Coad)P…