In a previous post we explored exposing an endpoint in a worker role to the outside world. Here we will examine one way to implement communication between worker roles internally.
Basically, the idea is this:
Figure 1 Direct Role to Role Communication in Windows Azure
We could implement an architecture where all worker roles communicate with each other directly. We could do this communication over TCP.
There are a lot of good examples of code and projects available showing how to do this (and other things!) on Microsoft sites and others. See, for example, the excellent hands-on labs in the latest Windows Azure Platform Training Kit. These sample applications and labs are a great way to get started using Windows Azure. I encourage you to check them out.
One issue I have with some of those examples, however, is that they often include other details that are not directly relevant to understanding the topic at hand. This can often be overwhelming to someone encountering the technology for the first time.
Let us here consider a very over-simplified scenario. We want all worker roles to be able to directly communicate with each other. What I have tried to do with this example is to eliminate all extraneous stuff. The goal here is to focus down to just the bare necessities of how to do worker role to worker role communication in Azure. Also we want to fit the demo into a 10 minute (maximum) YouTube clip!
Obviously this stuff can still be a little complicated!
It is worthwhile, I think, to mention that more complicated doesn’t necessarily mean better. If you are considering doing something like this, take a good hard look at your design. Is it possible that some other better established pattern (the “asynchronous web/worker role” for example) would be equally well or better suited to the task at hand?
Still, it is nice to know that, as developers, we do have the flexibility in Azure to do pretty much anything that we want and that can be done in .NET.
Consider attending a Learning Tree course to advance your .NET developer skills. We have a wide variety of offerings for the .NET developer, including:
And others too!
¡Viven los developers!