activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From guptaviv <>
Subject Re: Messages Stuck in the queue(with the broker)
Date Thu, 23 Jul 2009 05:52:08 GMT

Thanks for the quick response Dejan/mkeenan.

Yes we are using auto_acknowledge mode for both consumer and producer. Could
this be a problem?

Dejan,Here is my producer code:

public class SynchMessageProducer {
    private static int deliveryMode;
    private static int ackMode;
    private static boolean transacted = false;
    static {
        ackMode = Session.AUTO_ACKNOWLEDGE;
        deliveryMode = DeliveryMode.PERSISTENT;

    public static void main(String args[]) {
        FileSystemXmlApplicationContext ctx 
            = new

        JmsTemplate jmsTemplate = (JmsTemplate)ctx.getBean("jmsTemplate");
             String tradeID = args[0];
            Connection connection =
            Session session = connection.createSession(transacted,ackMode);

            //Setup a message producer
            MessageProducer producer =

            //Create a temporary queue that this client will listen for
            // then create a consumer that consumes message from this
temporary queue
            TemporaryQueue responseQueue = session.createTemporaryQueue();
            System.out.println("Temporary queue created:" +

            //create the message to be sent
            Message mes = session.createMapMessage();

            //Set the reply to field to the temporary queue you created
            //this is the queue the consumer will respond to

            String correlationId = createRandomString();

            //send the message

            // Wait for the response from the seed application
            MessageConsumer consumer =
            Message response = null;
            System.out.println("Waiting for Response.....");
            response = consumer.receive();


Below is the snippet from example-config.xml used by above producer:
    <bean id="jmsFactory"
        <property name="connectionFactory">
            <bean class="org.apache.activemq.ActiveMQConnectionFactory">
                <property name="brokerURL">


mKeenan, Broker restart certainly does the job but problem is this messages
are struck too frequently say after 10-11 messages so restarting the broker
would not be feasible n our case :(

guptaviv wrote:
> Hi,
> We are having the messaging setup where we are using one Listener and one
> one producer. 
> I am trying to repeatedly send the messages through the same producer. 
> The problem is, very frequently the messages are stuck in the queue with
> the broker.
> The listener is absolutely free and but still the broker is not
> dispatching the messages to the Listener.
> Following is the configuration that we are using for producer:
> deliverymode : persistent
> ackMode: auto_acknowledge
> We are not setting any other configuration parameters(using default).
> The problem gets fixed after some time when you restart the broker or
> Listener but the issue reappears after some time again.
> Is there any solution/workaround to this issue. Please let me know if
> anyone has thoughts/advices on this.
> Thanks,
> Vivek

View this message in context:
Sent from the ActiveMQ - User mailing list archive at

View raw message