Service Bus - Am I being dumb?
I've been looking at Mass Transit for a couple of months now, and I'm really intrigued by the possibilities. However, I don't seem to be able to get the concepts quite right. I've looked the code, and I've gone through the documentation, but I just don't feel that I"m understanding it.
The examples in general show;
开发者_Python百科Bus.Initialize( sbc =>
{
sbc.UseMsmq( );
sbc.VerifyMsmqConfiguration( );
sbc.UseMulticastSubscriptionClient( );
sbc.ReceiveFrom( "msmq://localhost/myqueue" );
} );
Now, I understand what this is doing, but I don't think my brain is taking the concept further than this. Here's what I do understand;
- Messages can be published from the software, and subscribed to within the service bus for action/s to be performed on receipt of that message.
- The Service Bus itself, sits on top of a messaging queue (either RabbitMQ or MSMQ in MT)
I just want to understand a little more about this. I don't think I"m getting it. Do I need a server configured, listening? Do I set it up in my software then just publish messages, they get picked up and processed from within?
First off, getting start with MassTransit...
- MT's documentation http://readthedocs.org/docs/masstransit/en/develop/index.html
- MT's mailing list http://groups.google.com/group/masstransit-discuss
The idea is that you have multiple systems communicating. Now that's just messaging and doesn't really require MassTransit. A
talks to B
. When we start talking about pub/sub it can become more interesting. A
publishes msg CreateOrder
which B
is listening for. When B
receives that CreateOrder
message it can take whatever steps is required to handle a new order. This leaves the services decoupled, the only interaction point is a pretty simple message, the CreateOrder
.
Now the joy of pub/sub is that A
and B
are going back and forth for a while, and we have C
that wants to listen into CreateOrder
messages so it can prepare stock for shipping before B
completes all its tasks. We can drop C
into the bus, it subscribes to the CreateOrder
message and neither A
nor B
need to change any code. This can be done while they are actively sending messages back and forth. You need to upgrade one of the members involved? Just stop that service, drop in the new one, and restart it, allowing it to pick it where it left off.
If you have more questions on this topic, I'd try hitting up the mailing list. I'd like to believe we are rather responsive when we can be. Additionally you can hit up a couple related questions and books ...
- What is an ESB and what is it good for?,
- Enterprise Service Bus Terminology, or
- Enterprise Service Bus: Theory in Practice and
- Enterprise Integration Patterns: Designing, Building, and Deploying Messaging Solutions.
Enterprise Integration Patterns is a great book, even if was written more with Java in mind.
精彩评论