Using NServiceBus with multiple applications acts as Publisher and Subscriber

I am trying to use NServiceBus to combine 4 apps.

All of these applications should act as Publisher and Subscriber.

The only way I've got ti to get it working is to create a "master" queue named Server, on which appear in MessageEndpointMappings in all app configurations, but I think that's not very good ...

So how do I set up NServiceBus on this whole application to get this to work?

Attachment 1:

  <MsmqTransportConfig InputQueue="MyApp1" ErrorQueue="Errors" NumberOfWorkerThreads="1" MaxRetries="5"/>
  <MsmqSubscriptionStorageConfig Queue="Subscriptions" />
  <UnicastBusConfig>
    <MessageEndpointMappings>
      <add Messages="MyApp.Messages" Endpoint="Server" />
    </MessageEndpointMappings>
  </UnicastBusConfig>

      

Appendix 2:

  <MsmqTransportConfig InputQueue="MyApp2" ErrorQueue="Errors" NumberOfWorkerThreads="1" MaxRetries="5"/>
  <MsmqSubscriptionStorageConfig Queue="Subscriptions" />
  <UnicastBusConfig>
    <MessageEndpointMappings>
      <add Messages="MyApp.Messages" Endpoint="Server" />
    </MessageEndpointMappings>
  </UnicastBusConfig>

      

Appendix 3:

  <MsmqTransportConfig InputQueue="MyApp3" ErrorQueue="Errors" NumberOfWorkerThreads="1" MaxRetries="5"/>
  <MsmqSubscriptionStorageConfig Queue="Subscriptions" />
  <UnicastBusConfig>
    <MessageEndpointMappings>
      <add Messages="MyApp.Messages" Endpoint="Server" />
    </MessageEndpointMappings>
  </UnicastBusConfig>

      

Appendix 4:

  <MsmqTransportConfig InputQueue="MyApp4" ErrorQueue="Errors" NumberOfWorkerThreads="1" MaxRetries="5"/>
  <MsmqSubscriptionStorageConfig Queue="Subscriptions" />
  <UnicastBusConfig>
    <MessageEndpointMappings>
      <add Messages="MyApp.Messages" Endpoint="Server" />
    </MessageEndpointMappings>
  </UnicastBusConfig>

      

+2


a source to share


1 answer


NServiceBus prefers that you follow the pattern of a specific type of post, published by only one service. Typically you will have an assembly of "messages" for each service, for example:

  <MsmqTransportConfig InputQueue="MyApp1" ErrorQueue="Errors" NumberOfWorkerThreads="1" MaxRetries="5"/>
  <MsmqSubscriptionStorageConfig Queue="MyApp1Subscriptions" />
  <UnicastBusConfig>
    <MessageEndpointMappings>
      <add Messages="MyApp2.Messages" Endpoint="MyApp2" />
      <add Messages="MyApp3.Messages" Endpoint="MyApp3" />
      <add Messages="MyApp4.Messages" Endpoint="MyApp4" />
    </MessageEndpointMappings>
  </UnicastBusConfig>

      



If you want to publish the same post type from all four applications, you can send a Bus.Send () message to the central event publisher service, which can then be Bus.Publish ().

+4


a source







All Articles