Search code examples
nservicebusfailovermasstransit

Failover scenarious for the Service Bus with NServiceBus or MassTransit


I need to build Identity server like Microsoft's http://login.live.com.

To handle failover I will have multiple web servers nodes. The plan is that all database write operations are done by sending messages to the database server. Database will be mirrored or replicated. The idea is that database subscribes to the write operations but that other nodes subscribe also. That way other nodes do not need to read from database and can update their caches.

I am just starting to learn the service bus architecture and what is not clear to me is how to handle failover scenario for the service bus.

Question:

  1. If database server is not available, what will happen with the published messages ?
  2. Will they be stored somewhere and where ?
  3. Do I need additional machine or a cluster to handle failover of the service bus?
  4. I read that SQL Server can be used as a message store but can I use durable MSMQ? I am queuing messages to be able to write them to the database so why would I store them to the DB first just to take them and write them again? OR, I am getting this wrong and DB is only used for the list of subscriptions and not for the Messages?

Solution

    1. This will depend on how it is setup, but in MassTransit you can leave the subscription active so the message will still be delivered to the queue for the DB. When the DB is active again, you can read the messages in the queue.

    2. Each service connected to a service bus, in MassTransit, has an active queue for itself. The messages will be stored there.

    3. I think this is a "it depends"... MassTransit has support for other MQs than MSMQ but is really built around MSMQ. We have no experienced great support for things such as failover from MSMQ. However, everything will continue to run without fault if the subscription service (i.e. the bus) fails - the services already know who to talk to. It's only when a change in a consumer (subscribe or unsubscribe) where this becomes a problem. For me, that's an event that happens almost never.

    4. With MassTransit, we use the DB to store the subscription states but all the messages are stored in MSMQ.

    If you'd like more details in one of these responses or have additional questions about MT, you can join us on the mailing list: http://groups.google.com/group/masstransit-discuss.