Reputation: 34840
I can use this code to get the return address.
string returnAddress = Bus.CurrentMessageContext.ReturnAddress;
But how do i get the "to address" of the message. i.e. the Queue that NServiceBus pulled the message from.
I had a look through the source and it seems Bus.Transport.Address is what i want but there is no get on Transport
Note: I am within the "Handle" method of a message handler.
Upvotes: 1
Views: 811
Reputation: 6050
This should be the same address that is in your MsmqTransport configuration section. You should be able to pull that section and grab the value.
String address = Configure.ConfigurationSource.GetConfiguration<MsmqTransportConfig>().InputQueue;
Upvotes: 2
Reputation: 34840
Seems i just get it injected by adding a property
public ITransport Transport { get; set; }
And then accessing
Transport.Address
NOTE: turns out that in the latest source there is no property "Address" on ITransport. So this answer is not correct :(
Upvotes: 0