0

I am reading a lot about Servicebus implementations (NServicebus, MassTransit,...) and I think I have understand how a Servicebus works. I am still not sure what the right scenario is to use one, because I know myself and I tend to use technologies although they may be an overhead for needs.

So my question is: What are some good reasons/scenarios to use a Servicebus and do I need to use DDD technics to use it?

Some scenarios I thought of:

  • Communication with external systems (e.g. my application is communicating with external systems and I want to make sure these get called, e.g. I persist an object within my database but I also have to call an external Webservice to synchronize data. I would create a Command and I would have 2 Handlers that get the event, one persisting to my database, the other one handling the webservice. If on command fails it will be retried)
  • Scalability (I would be able to scale out on multiple machines)
  • It may lead to cleaner code (instead of performing several sequential tasks when e.g. an Entity is updated I oculd have different Messagehandlers that perform these tasks in isolation, e.g. save the entity, another Handler could perform an update on a denormalized datastore etc).
4

1 回答 1

2

I think you nailed some good ways of using NserviceBus. I haven't used it yet in any project but I have done some hands on labs just to figure out how it works. I though have a an old colleague that told me that they threw out biztalk integration server in favor for system - to - system integration with a servicebus.

Don't forget support for Saga's which is very handy when you have dependencies between messages. NService bus gives you type safety communication endpoints which can be transactional and asynchronous, thums up.

In DDD servicebus gives your application a great tool to handle asynch Domain Events, like fire and forget. Suitable when you develop a web application and need to send email, facebook integrations, twitter, saving data to file on disc, send messages to applications.

I think it's almost in our nature to complicate things, so I see it as a good sign of self perspective when you say "I know myself and I tend to use technologies...". Like Udi Dahan title him self A Software Simplist. Try to make it to production.

于 2012-02-07T20:36:26.307 回答