Is there a way to monitor messages in ActiveMQ JMS topic and most importantly delete older messages, e.g. delete messages older than a month ago.
I am using Apache Camel to build ActiveMQ Connection and JMS topics.
There is a header within sent JMS messages called time to live, which when surpassed will remove the messages from the queue.
It is possible to achieve the same affects at the broker level.
Further information can be found here http://activemq.apache.org/manage-durable-subscribers.html
Related
My requirement is to clear all the messages from queue before processing the flow or publishing anything in the queue.
We are using rabbitMQ and due to some reason messages are stucked in the queue and because of that we are facing some issue when we are counting the queue based on the messages. so for the next time before processing we have to clear the queue.
Here we have multiple queue like slave1, slave2,slave3 and when api will be triggered in the process section we have to clear the queue.
Kindly suggest how we can do this in mule3.
Mule 3 has a generic AMQP connector. It does not support administrative commands from a specific implementation like RabbitMQ, so you can't use the connector.
You could use RabbitMQ REST API and call it using the HTTP Request connector. See this previous answer to see how to delete queues with Curl, then implement the same request with HTTP Request: https://stackoverflow.com/a/29148299/721855
I have a topic and three queues in activeMQ. Producer is publishing the message to the topic and it's routing the same message in these three queues. Now my question is:
I haven't set persistency in producer and I don't want to because of some project limitation. How caan I set persistency for the topic and queues from ActiveMQ broker? I am using ActiveMQ 5.15.12 version.
Can I set persistency for one queue and don't set for another?
What will happen if I don't use the persistency? I know there have chances of losing messages during broker restart but is there any other way to overcome this issue?
I've got a Java application that uses RabbitMQ. This application creates a TOPIC exchange and pushes messages to the TOPIC with its own routing key. From this way if I want the data from any application I create a queue binding with the exchange TOPIC and the routing key I want to.
I want to do the same thing by using a Java application with Qpid JMS as the client and ActiveMQ as the server. The information says it's possible, but I don't know how. I cannot found a specific example seems to RabbitMQ. I can create queues but I don't know how to create the exchange and the binding. What steps should I follow to achieve it?
You might consider using ActiveMQ Artemis instead of ActiveMQ 5.x as the address model of Artemis is much more similar to RabbitMQ's than 5.x's address model (which is more JMS-centric).
As far as JMS goes I think what you need is:
A topic. This is analogous to the "exchange" from RabbitMQ. Any message sent to a JMS topic is delivered to every subscriber. It's basic publish/subscribe semantics.
A topic subscriber with a selector. As noted in #1, every subscriber on a topic will get any message sent to that topic, but a JMS "selector" can be used to filter messages similar to the routing key in RabbitMQ.
An agreed-upon key for a message property. In order to create a viable selector for the topic subscriber the producer and the subscriber must agree upon the property key to filter on.
If each subscription is going to have lots of messages and those messages need to be shared among multiple subscribers/consumers (e.g. for load-balancing/distribution) then you will need to use a JMS "shared subscription." However, shared subscriptions are only part of JMS 2 and only ActiveMQ Artemis implements JMS 2. You can't use ActiveMQ 5.x with JMS shared subscriptions as it only supports JMS 1.1.
Both ActiveMQ 5.x and ActiveMQ Artemis create server-side resources (e.g. topics, queues, etc.) on-demand by default so all you need to do is write your JMS application.
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.
I am very new to JMS and ESB.
I am using activemq as JMS and mule as ESB. When i am forwarding the messages from one queue to another with jms connector parameter "persistentDelivery" as "true" it retains the messages in the target queue after activemq re-start. But in case of forwarding messages from one topic to another,the messages are not retained in the target topic after restart.
Is there any limitation for persistence of messages in case of topic in activemq?
Thanks in advance.
Regards,
Arijit
topics are different in that messages are only retained if there is a durable consumer.
see these for more info...
http://activemq.apache.org/how-do-durable-queues-and-topics-work.html
http://stefanlearninglog.blogspot.com/2009/07/persistent-jms-topics-using-activemq.html
Topics in Activemq are not durable and persistent, so in case one of your consumer is down. You would lost your messages.
To make topic durable and persistent you can create a durable consumer by creating unique client id per consumer.
But again, that is not distributed in case you are following microservices architecture. So multiple pods or replicas will create problem while consuming messages as in no load balancing is possible for durable consumers.
To mitigate this scenario, there is a option of Virtual topics in Activemq.More details have been provided below,
You can send your messages via your producer in topic named as VirtualTopic.MyTopic.
** Note: you must have to follow this naming convention for default activemq configuration. But yes there is also a way to override this naming convention.
Now, to consume your messages via multiple consumers, you have to set naming convention for your consumer side destination as well for eg. Consumer.A.VirtualTopic.MyTopic
Consumer.B.VirtualTopic.MyTopic
These two consumer will receive messages through the topic created above, also with load balancing enabled between multiple replicas of same consumer.
I hope this will help you fixing your problem with activemq topic.