Closed mteinum closed 4 years ago
Hi
Please try following code in the router config:
var msmqIface = routerConfig.AddInterface<MsmqTransport>("MSMQ", t => {});
msmqIface.EndpointInstances.AddOrReplaceInstances("code-config", new List<EndpointInstance>()
{
new EndpointInstance("Foo", null).AtMachine("C")
});
This should instruct the MSMQ transport to use machine C properly. The InstanceMappingFile
API, although attached to the transport config, requires full NServiceBus as it is based on features which Router does not recognise. You need to use the lower level EndpointInstances
API.
Hi Szymon,
I've been trying this exact scenario with your recommended code and for me, it still creates the message on the same machine that the router is on, rather than the remote machine (machine "C" in the example above).
Can I confim, what does the "code-config"
bit do? I've copied it verbatim but perhaps wondering if I shouldn't have. Here's my router code for clarity:
const string sagaMsmqInterfaceName = "SAGA_MSMQ_INTERFACE";
var sagaMsmqInterface = routerConfig.AddInterface<MsmqTransport>(sagaMsmqInterfaceName, extensions => { });
var appServerSaga = new EndpointInstance(SagaEndpointName, null);
appServerSaga.AtMachine("REMOTE-MACHINE-NAME");
sagaMsmqInterface.EndpointInstances.AddOrReplaceInstances("code-config", new List<EndpointInstance>
{
appServerSaga
});
sagaMsmqInterface.EnableMessageDrivenPublishSubscribe(CreateSqlSubscriptionStorage());
sagaMsmqInterface.AutoCreateQueues();
Using NServiceBus 7.2.2, and NServiceBus.Router 3.6.0
I've redone this using fresh endpoint names and now it works. Something must have got itself confused along the way.
Hey hey. Sorry for the late reply. I was at a conference for last couple of days. Glad that it works now :)
No worries! Solved a fairly major problem so thanks for the original response :)
Hi!
We have this setup
machines: A, B and C.
Sending BarCommand from A via B Router to B Bar endpoints works great.
How can A send FooCommand to C (Foo) via B?
I have tried: 1.
but this fails with invalid address
But the router still delivers FooCommand to its local machine Foo@B