Host Names with Callbacks

When using the callbacks feature, is there a way to control how the host name portion of the replyTo address is generated? The two servers that I’m trying to communicate between are in different network zones, so they can’t resolve each other’s name using an unqualified host name.

In general, I have ServerA which uses Request<T> to send a command to ServerB, which then replies with an enum response.

For sending the request, I can find the destination (ServerB) because I’m using an instance mapping XML file that uses IP addresses to identify the machines. The destination machine handles the message correctly, but then the reply message gets stuck in the outgoing queue because it can’t resolve the original sender by host name (ServerA).

For testing purpose, by modifying the DNS to add a new entry for ServerA in ServerB’s network zone, I was able to get the response to get sent successfully, but this is not my IT department’s first choice of how to deal with this scenario since it requires them to manage substantially more DNS entries.

I tried using OverridePublicReturnAddress to explicitly specify the return address, but it does not appear to have any impact. Is there some way that I can either make the replyTo use an IP address or a fully qualified host name (e.g. serverA.mydomain.com or 192.168.0.1).

In NServiceBus 5, this did work correctly even though the NServiceBus 5 message headers also refer to the machine by host name. From the MSMQ management UI, I can see that NServiceBus 5 seems to be somehow resolving the return address by IP rather than name.

Hi, Dennis!

Have you looked at Using Fully Qualified Domain Names • MSMQ Transport • Particular Docs ?

I’m pretty sure you can solve your problem by overriding RuntimeEnvironment.MachineNameAction to return a Fully Qualified Domain Name(FQDM) instead of the default machine name. It’s used for originator and reply-to address.

Regards,
Jan Ove Skogheim

That was exactly what I needed.

Thanks for your help.

Dennis