views:

76

answers:

1

I have load balanced web servers, that with the existing code base, handles when a user logs into the site. I would like to send a broadcast message to any applications that have subscribed saying 'hey x logged in' ? So have many web servers and many applications subscribing.

How does discovery work/configuration work with nservicebus ? Should each application know about each web server and subscribe individually or is this where the distributer comes in, so web servers all send to the 1 distributer and all application subscribe to single distributer and the distributer relays the message ?

I've tried to research this, but having troubles.

Thanks

MrT

+2  A: 

First, see the guidance from this NServiceBus group thread about publishing a message from a web application (or more specifically, about NOT publishing a message from a web application):

http://tech.groups.yahoo.com/group/nservicebus/message/6904

Taking all that in consideration, I would recommend your webservers Send() a message to a central event aggregator, which could then Publish() events that other applications (or your web applications) could subscribe to.

More specifically:

  • MyWeb on Webserver1 (with input queue MyWeb@Webserver1) Send()s a UserChangeMessage to queue WebEventBroker@CentralServer
  • WebEventBroker app, running on CentralServer, with input queue WebEventBroker@CentralServer, receives UserChangeMessage, and publishes UserChangedEvent
  • The MyWeb application subscribes to events of type UserChangedEvent, so when it is published, it is received by queues MyWeb@Webserver1 and MyWeb@Webserver2 where both web applications can process the message and take appropriate action.
David
Does the event broker need to be a distributor ? I can't get this working. Any chance you can provide sample configs ?
Mrt