activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nakarikanti, Nageswara" <>
Subject RE: How to disable consumption from one queue "temporarily" ?
Date Thu, 31 Mar 2011 16:12:10 GMT

I do not know this is the best / good one, But I got an Idea. 

1. Create a new JMS Message by setting its JMS Type (abstract public void setJMSType(String
org) throws javax.jms.JMSException) like 'WAIT_FOR_SOME_TIME'.

2. In Your ProjectConstants program (if any, other wise a global constant) create a string

3. In onMessage 

		public void onMessage(Message message) {

			try {
				if (ProjectConstants.JMS_MSG_TYPE_WAIT.equals(message.getJMSType())) {
				else if (message instanceof TextMessage//or some other JMS Message Type) {
			} catch (JMSException e) {
				logger.error("JMSException", e);

Thank You,

-----Original Message-----
From: Sylvain Vittecoq [] 
Sent: Thursday, March 31, 2011 5:06 AM
Subject: How to disable consumption from one queue "temporarily" ?

Hello all,

We are using ActiveMQ 5.4.2 with the activemq-cpp library 3.2.4.

Our topology is the following :

    * A set of Linux processes (consuming and producing messages) are
      connected to a Broker A.
    * Another set of Linux processes (consuming and producing messages)
      are connected to a Broker B.
    * Broker A and Broker B are connected to each other.

We have activated the producer flow control on all queues (we do not use topics at this point)
and all our messages are non-persistent messages.
I believe this is the only deviance from the default configuration.

My question is the following :
Each process may consume messages from different queues.
What is the "best" way for such consumer to indicate that it does not want to receive any
new message from a specific queue ?
(But this consumer must keep receiving messages posted on its other queues).

One solution seems to clear the MessageListener for this specific Consumer :
to not receive any message and then later on set again the 
MessageListener when the processing can resume for this queue inside 
this process:
However in our environment it seems that the /*setMessageListener() 
API*/ must be executed by a thread which can NOT be the ActiveMQ thread 
calling the onMessage callback function.
So is there an easier solution which does not require this extra 
application thread ?

Thank you very much for your help,


Sylvain Vittecoq
Cell : +46 (0) 7 67 77 76 10
SkypeId: sylvainvittecoq

View raw message