ActiveMQ Artemis divert to multiple addresses - activemq-artemis

I am migrating from ActiveMQ "Classic" to ActiveMQ Artemis. ActiveMQ "Classic" has composite destinations which can forward messages to multiple destinations.
ActiveMQ Artemis uses diverts to forward messages. Can you have one divert to multiple addresses or do you need a separate divert config for each address you wish to forward onto ... for each?

At this point you'll need an individual <divert> for each address where you want to forward the message.
However, in the upcoming ActiveMQ Artemis 2.21.0 you'll be able to forward messages to multiple addresses from a single divert. See ARTEMIS-3670 for more details.

Related

ActiveMQ Artemis: Virtual Topic and Dead Letter Queue

We are migrating from ActiveMQ "Classic" to ActiveMQ Artemis.
On ActiveMQ "Classic" we were using Virtual Topics. They were created with virtualDestinationInterceptor:
<virtualTopic name="VirtualTopic.>" prefix="Consumer.*." selectorAware="false"/>
There is also deadLetterStrategy to automatically create the dead letter queue by appending .Dead at the end of the queue name.
With that setup when a message is undelivered on a Virtual Topic consumers queue it is placed on a queue with the same name suffixed with .Dead.
On ActiveMQ Artemis we have reproduced that by setting the OpenWire parameter virtualTopicConsumerWildcards=Consumer.*.>;2.
The result it that when a consumer is listening on the queue Consumer.CLIENT_ID.VirtualTopic.QUEUE_NAME he receives messages sent to the address VirtualTopic.QUEUE_NAME.
The corresponding FQQN is therefore VirtualTopic.QUEUE_NAME::Consumer.CLIENT_ID.VirtualTopic.QUEUE_NAME.
The dead letter mechanism is reproduced by configuring the broker with auto create dead letter resource and suffixing the created queue with .Dead:
<address-setting match="#">
<dead-letter-address>DLQ</dead-letter-address>
<auto-create-dead-letter-resources>true</auto-create-dead-letter-resources>
<dead-letter-queue-prefix></dead-letter-queue-prefix>
<dead-letter-queue-suffix>.Dead</dead-letter-queue-suffix>
...
</address-setting>
The result is that when a message is not delivered it ends on the DLQ address on a queue with the name of the original address suffixed with .Dead. FQQN: DLQ::VirtualTopic.QUEUE_NAME.Dead.
Question: How can we send the undelivered messages to a dead-letter queue with the same name as the consumed queue: FQQN Consumer.CLIENT_ID.VirtualTopic.QUEUE_NAME::Consumer.CLIENT_ID.VirtualTopic.QUEUE_NAME?
I was hoping that a divert could hook in but that has not effect. The undelivered message is still ending on the DLQ address:
<diverts>
<divert name="virtualTopicDeadDivert">
<address>DLQ</address>
<forwarding-address>Consumer.CLIENT_ID.VirtualTopic.FunctionalTest.Dead</forwarding-address>
<!--filter string="_AMQ_ORIG_QUEUE='Consumer.CLIENT_ID.VirtualTopic.QUEUE_NAME'"/-->
<exclusive>true</exclusive>
</divert>
</diverts>
There is currently no way to send an undelivered message to a dead-letter address with a queue which is automatically created and named according to the queue where the message was originally sent.
This mismatch in behavior is a consequence of the naming convention and the semantics of virtual topics in ActiveMQ "Classic" combined with the semantics of the address model of ActiveMQ Artemis. To be clear, ActiveMQ Artemis is not meant to be a feature-for-feature reimplementation of ActiveMQ "Classic." Rather, it is a new implementation with features and abilities not possible on ActiveMQ "Classic" with equivalent (and sometimes identical) behavior where it makes sense.
Please note that virtual topics in ActiveMQ "Classic" were originally developed to deal with some of the shortcomings of JMS topic subscriptions in JMS 1.1. However, these limitations are already dealt with by the fundamental address model of ActiveMQ Artemis, but more importantly these limitations are already dealt with in JMS 2.0. ActiveMQ "Classic" doesn't yet support JMS 2.0, but ActiveMQ Artemis always has. You might consider moving a way from virtual topics and using JMS 2.0 instead.

Configure ActiveMQ Artemis message redelivery on the client side

I wonder if it is possible to configure message redelivery on the client side. I have read the ActiveMQ Artemis docs and have not found any information about this feature. So I made a conclusion that there is no opportunity to configure message redelivery on the client side. The only place to configure message redelivery is the broker.xml file. Am I right about it?
By the way I can configure the connection to ActiveMQ Artemis by using broker URL params or by application.yml since I using Spring Boot 2.x.
ActiveMQ Artemis supports AMQP, STOMP, MQTT, OpenWire, etc. Many clients exist for these protocols written in lots of different languages across all kinds of platforms. Whether or not a given client supports client-side redelivery is really up to the client itself. You don't specify which client you're using so it's impossible to give you a specific yes/no answer.
However, I can say that ActiveMQ Artemis ships a JMS client implementation which uses the core protocol. That client does not support client-side redelivery. However, the OpenWire JMS client shipped with ActiveMQ "Classic" does support client-side redelivery, and it can be used with ActiveMQ Artemis as well.

ActiveMQ Browser setup for ActiveMQ Artemis

I am trying install ActiveMQ Browser, and I wanted to connect with my ActiveMQ Artemis server. How do we configure that?
I assume you're talking about this ActiveMQ Browser GUI tool.
If that assumption is correct then there's no way to integrate it with ActiveMQ Artemis as it's hard-coded to use the specific JMX management beans from ActiveMQ 5.x.
I recommend you use the ActiveMQ Artemis web console. It has a rich set of functionality that should cover most of the use-cases you're interested in. Among other things, it will allow you to:
Send new messages to addresses.
Delete messages.
Move messages to another address.
Create or delete addresses & queues.
Shutdown broker.
etc.

Where is the REST API for ActiveMQ Artemis?

We test Apache Artemis. We actual use ActiveMQ 5.x
We send messages from our Software to the broker like the URI:
localhost:8161/api/message/QueueName with a POST-Request, but this doesn't work in Artemis. I looked around but I didn't find how it should be in Artemis.
Do you know how we can do that?
As noted in the documentation for the REST interface, the default broker doesn't deploy the necessary HTTP endpoints. You'll need to configure and deploy the REST interface as described in the documentation.
That said, the REST interface in ActiveMQ Artemis is different from the one in ActiveMQ 5.x. The two are not compatible.

One JMS message copied to two queues

How do I configure activemq such that a JMS message published to a topic is passed on to two JMS queue.
Is this possible in activemq?
Or
Is it better to use a simple topic with two subscribers. Both picking up their own copy of a message.
Instead of trying to configure the Broker to do this you are better off using Apache Camel to create the routing behaviour you are looking for. Camel routes can be embedded in you ActiveMQ instance.