Hi all,
I have a service which needs to run on multiple machines picking jobs off of a single queue ensuring each job is only undertaken by a single service. I also need to publish messages for all services to receive, such as reload triggers.
Is this possible in nservicebus without too much hacking?
I have proved that both the publish model and send model work for me but as soon as my client needs to deal with both architectures, it treats them all as a send architecture and not all services receive the publish methods.
Here are the config files I have so far:
Publisher (all services need to receive these messages), uses Bus.Publish<...>(...):
<MsmqTransportConfig InputQueue="ConfigQueue" ErrorQueue="error" NumberOfWorkerThreads="1" MaxRetries="5" />
<UnicastBusConfig DistributorControlAddress="" DistributorDataAddress="" ForwardReceivedMessagesTo="">
<!-- Message publishers don't require message queues -->
<MessageEndpointMappings /> </UnicastBusConfig>
Sender (only one service can pick these up), uses Bus.Send<...>(...):
<MsmqTransportConfig InputQueue="BrokerQueue" ErrorQueue="error" numberOfWorkerThreads="1" MaxRetries="5" />
<UnicastBusConfig DistributorControlAddress="" DistributorDataAddress="" ForwardReceivedMessagesTo="">
<MessageEndpointMappings>
<add Messages="EventMessage, Messages" Endpoint="AgentQueue" />
</MessageEndpointMappings> </UnicastBusConfig>
Services (each have the same local queue name and subscribe to the publisher above):
<MsmqTransportConfig InputQueue="AgentQueue" ErrorQueue="error" NumberOfWorkerThreads="1" MaxRetries="5" />
<UnicastBusConfig>
<MessageEndpointMappings>
<add Messages="NServiceBus.Messages.ReloadMessage, NServiceBus.Messages" Endpoint="ConfigQueue" />
</MessageEndpointMappings> </UnicastBusConfig>