0

I'm using ActiveMQ "Classic," and I want to use AMQP protocol.

For the moment I am trying to use AMQP 1.0 and the Java client Qpid JMS client 2.2.0 and qpid-amqp-1-0-client-jms 0.32 with Spring Boot 3 and jakarta package.

The final goal is to fully use AMQP and after possibly replace ActiveMQ by another broker without changing my code, but I use VirtualTopic, and if I understand AMQP can do the same thing like VirtualTopic by using "routing key" with wildcard.

I have configure a simple Java sender and consumer and all work fine, but now i want to use "routing key" to publish a message on topic TEST.*, but I'm stuck here and I don't know how to set my routing key with wildcard.

Justin Bertram
  • 29,372
  • 4
  • 21
  • 43
  • Can you elaborate on your use-case? There is no concept of routing key or even of "VirtualTopic" in JMS. If you want to keep your code portable so that you can swap brokers eventually you should almost certainly avoid these non-spec elements as they will be have different or not even be available on other brokers. – Justin Bertram Apr 04 '23 at 15:42
  • Also, keep in mind that if you're using Qpid JMS and Spring Boot 3 with ActiveMQ "Classic" you will have limited functionality since ActiveMQ "Classic" doesn't fully implement JMS 2. – Justin Bertram Apr 04 '23 at 15:44
  • Also keep in mind that amqp-1-0-client-jms 0.32 is a deprecated client that doesn't support the complete AMQP 1.0 JMS mapping which will likely cause issues with most JMS / AMQP brokers – Tim Bish Apr 04 '23 at 16:18
  • And also keep in mind the "routing-key" is not a mechanic in the AMQP 1.0 specification but a leftover from the non-standard AMQP 0.10 draft which is not an official specification. – Tim Bish Apr 04 '23 at 16:23
  • ok thanks for all this explaination! thats more clear for me ;) i m just at the beginning of my research. thanks – Mançaux Pierre-Alexandre Apr 05 '23 at 07:07
  • @JustinBertram another question, does it possible with apache qpid to send an exchange with binding TEST.* and activemq forward this message on all queue that match this pattern? i think amqp work like this no or i miss something? thanks – Mançaux Pierre-Alexandre Apr 05 '23 at 12:46
  • AMQP 1.0 doesn't have the same mechanics as the older AMQP 0.x draft specifications, there are no exchanges or bindings. You should have a read of the AMQP 1.0 specification. – Tim Bish Apr 05 '23 at 13:01
  • I would suggest framing a new question based just on use of a singular client like Qpid JMS and the broker (Artemis) and what it is you want to accomplish using Topics and Queues as those are the client mechanics you would be working with along with broker configuration.. – Tim Bish Apr 05 '23 at 13:42

1 Answers1

0

Consider inverting your app design to have consumers declare their interest vs the publisher sending to a list (or wildcard match) of destinations.

A good tenant of pub-sub is to separate producers and consumers from addressing and this reduces coupling. This is one of the more powerful features of Virtual Topics-- they are super practical.

There is nothing out-of-spec about using Virtual Topics. Producers simply publish to a topic, and consumers read from queues. This capability is available in several JMS-spec brokers, and does not lock you into ActiveMQ. The difference with ActiveMQ 5 is that the administrative overhead is super low.

  1. Publish message to a 'topic' - "TEST.EVENT"

  2. Any interested consumer registers themselves by connecting and creating a queue (or the queue can be created administratively) "Consumers.APP-1.TEST.EVENT", "Consumers.APP-2.TEST.EVENT", etc. You also have the capability for consumers to register selectors, so they only get filtered messages.

  3. As a bonus, networking brokers in a cluster becomes more straight-forward as their are unexpected hang-ups when clustering topics.

  4. This is not protocol or language specific. You can send/recv using different programming languages (Java, .NET, JavaScript, Pythong, etc) or protocols -- AMQP, JMS (openwire), STOMP, MQTT, etc and it "just works"

Matt Pavlovich
  • 4,087
  • 1
  • 9
  • 17