nservicebus - Howto subscribe to a message? How does auto/manual subscribe work? -


I have no problem in the concept of publishing / subscribing but I can not get my head around (auto) configuration .

Scenario

  1. I have Front-End Service (F1) which does a SEND of Command Message (M1).
  2. The command message is received by the back-end (B1) B1 does some processing and then the notification message makes a publication of M2.
  3. Two services (F1 and F2) should receive this notification message and their processing / work should be done.

[F1] = (M1) => [B1] = (M2) => [F1 & amp; F2]

How do F1 and F2 notification messages subscribe to M2 which is published / broadcast by B1?

I can not find the actual configuration either in .config files or code in नमस्कार. I can not find documentation about it on NServiceBus webcast.

is IBus. Subscribe & lt; T & gt; But I do not know how to subscribe to a certain example I expect that I need to supply a queue for which I have to send a membership message so that I can return / publish.

In short,

makes a publication in B1 of the M2 of M2.

  1. How can F1 and F2 subscribe to this message?
  2. How does this work when you do not use auto subscribing? So from the code or the config?

When you do not self-subscribe, you must explicitly Subscribe to code. Start by specifying the IWantCustomInitialization interface on your Endpoint Confiq class. After this you do not tell the NSB to subscribe automatically:

  NServiceBus.Configure.With (). DefaultBuilder () .XmlSerializer () MsmqTransport () ITSTransactional (true) .UnicastBus (). DonotOuto subscribe () .loadMessageHandlers ();  

Then apply the IWantToRunAtStartup interface within your customer endpoint. There you can subscribe to specific messages, for example:

  #region IWantToRunAtStartup member goes public zero () {this.Bus.Subscribe & lt; IProductUpdatedEvent & gt; (); This.Bus.Subscribe & LT; IProductCreatedEvent & gt; (); } Public Zero Stop () {this.Bus.Unsubscribe & lt; IProductUpdatedEvent & gt; (); This.Bus.Unsubscribe & LT; IProductCreatedEvent & gt; (); } #endregion  

Comments