Camel activeMQ Topic Publish Subscribe - activemq

Given the following route in camel.
.to("activemq:queue:REQUEST_QUEUE")
.to("activemq:topic:UPDATE_TOPIC_NAME");
I'm getting a timeout exception if I don't let any route listen to my topic.
Now I don't really want anyone to listen to this topic. I just want to deliver it to the topic and move on (Publish subscribe).
How can I do this with Apache Camel?

You could set ExchangePattern.InOnly like:
.to("activemq:queue:REQUEST_QUEUE")
.to(ExchangePattern.InOnly, "activemq:topic:UPDATE_TOPIC_NAME");
For more information see the Camel JMS documentation.

Related

ActiveMQ Bridge Configuration for Solace

I have a requirement to create a bridge between a Queue in ActiveMQ and a Queue in Solace. When ever there is a message in ActiveMQ Queue it should automatically get transferred to SolaceQ.
I'm struggling to find the steps for this configuration. I have ActiveMQ installed on my local machine. Request you to please throw some light on this.
FYI: I'm very new to ActiveMQ/Solace
I think you'll need to do this via JMS since both ActiveMQ and Solace support it. Check out ActiveMQ's docs here: https://activemq.apache.org/jms-to-jms-bridge

How to publish messages to a virtual topic in AMQP

I published messages to a topic in ActiveMQ using AMQP with the SenderLink API. I used the node address pointing to topic://topicname.
For VirtualTopic I went through this documentation. Changing the configuration as noted and renaming the topic name to VirtualTopic.TopicName is not publishing the messages on to queue.
Should the node address be different? Am I missing anything here?
The queue must exist before the message is produced.

How to listen to multiple brokers in activemq

I'm facing difficulty in finding a solution where my listener code in activemq should listen messages from multiple brokers. For an example: we have 4 brokers(1,2,3,4) which serves messages to consumers which is hosted in 4 servers (A,B,C,D). The consumerA should listen for response messages from broker1,2,3 & 4. If its finds the message, then consumerA should pick and process the message. If in case consumerA is down for any reason consumerB should listen to all 4 brokers.
Configuring failover transport in below way doesn't help me to achieve above design.
activemq.broker.url=failover:(tcp://localhost:61716,tcp://localhost:61717,tcp://localhost:61718,tcp://localhost:61719)?randomize=false,timeout=5000,maxReconnectAttempts=3
With above uri configuration my listener code only listens to broker on port 61716 and if the message is available on another broker say on port 61717 its not able to pick and process it. Any help will be really appreciated.
P.S: Is there any example for one consumer listening to multiple brokers at the same time?
As i'm not finding a solution from activemq for one consumer listening to multiple brokers, we have implemented a solution of creating multiple beans each pointing to one specific broker url. That way we are pointing to 4 urls from same server and from same listener configuration file.

Message Retry and adding poison message to DLQ in Spring JMS And ActiveMQ

I have a requirement to load messages from two queues and i am using ActiveMQ I have to implement the Retry mechanism in case of any error or network or application server failure and load back into the same Queue. Also, I want to load any poison messages to DLQ.
Please let me know if I can acheive these through Spring JMS. Also, please advise some good examples to accomplish this task. I checked Spring JMS documentation and have not much details in that.
This is a broker function with ActiveMQ - just configure the broker with the appropriate policies.
If using a DefaultMessageListenerContainer, you must use transacted sessions; then, if the listener throws an exception the message will be rolled back onto the queue and the broker's retry/DLQ policies kick in.
See the Spring documentation about enabling transactions.

Message Bridge - How to route messages from topic to queue - Glassfish

Is it possible to configure a message bridge for GlassFish? The message is currently posted to a topic, and customer requirement is to "redirect" this message from a topic to a queue. (both are on the same GlassFish server). By redirect, I mean, the message will be posted on the topic and then copied to the queue. I cannot find much documentation about this, I have read about Open MQ, JMS broker and JMS bridge, but this does not seem to fit this requirement.
I understand, that I can implement a topic subscriber and then post a message to queue. But I would like to know, if it is possible to do this just by configuration or do I have to implement a bridge?
Thanks for your help, I do appreciate it.
Vladi
You'll need to implement a bridge... or change the submitter to submit to both the queue and the topic.