activemq-nms-amqp icon indicating copy to clipboard operation
activemq-nms-amqp copied to clipboard

Amqnet 834 add better access to ConsumerDestination

Open Jefwillems opened this issue 1 year ago • 3 comments

see: https://issues.apache.org/jira/browse/AMQNET-834

This pull request adds a makes the property "consumerDestination" public. This enables applications to view the fully qualified destination name, when subscribed to a topic, instead of only the topic address.

E.g. now, when you are subscribed to a topic "topic.my.topic::consumer.topic.my.topic", and you receive a message with nms. When you look at NMSDestination on the message, you'll only see "topic.my.topic" With this pull request, and possible an extra one to nms-api (for the IMessage type), you can look at NMSConsumerDestination, and you'll see "topic.my.topic::consumer.topic.my.topic".

The only way we can get the fully qualified name now, is trough reflection:

var prop = msg.GetType()
                    .GetProperty("consumerDestination", BindingFlags.NonPublic | BindingFlags.Instance);

Jefwillems avatar Aug 08 '23 11:08 Jefwillems

@Jefwillems technically the "queue" part (in artemis its modelled as a queue on a multicast address, other brokers (solace, swiftmq etc) may model it differently so need to be careful on naming) in the fqqn on a topic is actually in NMS/JMS parlance is the subscription name.

As well the subscription name is tied to the consumer, as such whilst the message has this internally in amqp implementation of nms, in other nms clients it may not be there, if you need to read back the subscription name, this would have to be off the consumer object, i would suggest a better "NMS/JMS" way would be to expose a getter on the IConsumer in NMS API, to get the JMS2 subscription name, this then would be possible to implement in other implementations of NMS, such as openwire one/when they support sharedsubs.

michaelpearce-gain avatar Sep 08 '23 03:09 michaelpearce-gain

btw sorry for slow response, summer kids holidays....

michaelpearce-gain avatar Sep 08 '23 03:09 michaelpearce-gain

@Jefwillems i guess my worry is exposing this at the nms api layer, what your doing peeking into something which is amqp specific..... not sure how much would want end users poking at internals, appreciate you know the internals as contributor to this project and you know the objects, and thus why you know you can "steal" this information from the internal details.

michaelandrepearce avatar Sep 08 '23 04:09 michaelandrepearce