Search code examples
.net-corenms

Is there a way to retrieve the queue / topic name from IDestination?


I can get IDestination from the received IMessage.NMSReplyTo. But I'd like to see its name (for logging). Is there a way?


Solution

  • The IDestination interface has a method to fetch the type of Destination that it represents and from there you can cast to the type of Destination which can then allow you to get the name. For instance an IDestination that return a type of Topic can be cast to an ITopic and from there you can call TopicName to read the destination name. For temporary destinations you don't really need to know the names in most cases as they are generated and their lifetime is linked to the connection.