How to define virtual Topic in Artemis

Solution Verified - Updated -

Environment

  • Red Hat AMQ
    • 7.2.x

Issue

  • Unable to define and use virtual topic
  • There seems to be two ways of using Virtual Topic in AMQ7.
    • using the Artemis FQQN comprised of the address and queue
Queue subscriptionQueue = session.createQueue("VirtualTopic.Orders::Consumer.C.VirtualTopic.Orders");
Error: Creating Queue: VirtualTopic.Orders::Consumer.C.VirtualTopic.Orders
Caught: xxx.yyy.JMSException: Address VirtualTopic.Orders is not configured for queue support [condition = amqp:illegal-state]

Resolution

  • With JMS1.1, a durable subscription is identified by the pair of clientId and subscriptionName. The clientId component must be unique to a connection on the broker.
  • JMS 2.0 adds the possibility of shared subscriptions with new API's that are fully supported in Artemis.
  • For example, a default 5.x consumer destination for topic VirtualTopic.Orders subscription A:
Queue subscriptionQueue = session.createQueue("Consumer.A.VirtualTopic.Orders");
    session.createConsumer(subscriptionQueue);
  • Test java client is attached

Attachments

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments