SzymonPobiega / NServiceBus.Router

Cross-transport, cross-site and possibly cross-cloud router component for NServiceBus
MIT License
5 stars 10 forks source link

Unable to provide destination machine/site for subscriptions registered via bridge.RegisterPublisher #36

Open karolus888 opened 4 years ago

karolus888 commented 4 years ago

Hi Szymon,

We have encountered the problem when trying to register MSMQ publisher which is located on different physical machine than the Router we connect to. On the client side we have the following code: var routing = c.UseTransport<RabbitMQTransport>().Routing(); var bridge = routing.ConnectToRouter("Router"); bridge.RegisterPublisher(typeof(SubscribedEvent), "Endpoint");

which leads to following errors in "Router" logs: NServiceBus.Unicast.Queuing.QueueNotFoundException: Failed to send message to address: [Endpoint@ROUTER-HOST] ---> System.Messaging.MessageQueueException: The queue does not exist or you do not have sufficient permissions to perform the operation. and, of course, the queue doesn't exist at ROUTER-HOST, we would like to send subscription to Endpoint@ANOTHER-HOST.

I suppose that this kind of routing should be done on client (connector) side, i.e. by specyfing "NServiceBus.Bridge.DestinationSites" header but this doesn't seem to be supported, looking at RouterSubscribeBehavior,

Could you please provide some guidelines how this kind of subscription routing can be achieved?

SzymonPobiega commented 4 years ago

Hi

You are right, the machine where the publisher is needs to be specified. Currently the only way to do it is on the Router. Take a look at this sample that shows how the EndpointInstances routing extensibility point can be used for this purpose.

There is no way to specify the publisher machine in the subscriber code. The reason for this is the subscriber should not have to know which transport is used on the other side of the router.