consuming messages from a connection pool can be problematic due to
prefetch[1]. Unconsumed prefetched messages are only returned when the
connection is closed, but with a pooled connection the connection
close is deferred (for reuse) till the pool closes. This leaves
prefetched messages unconsumed till the connection is resued.
The solution is to use pooled connections for producers and a non
pooled connection for consumers or disable prefetch or reduce the pool
to a single connection for consumers.

[1] http://activemq.apache.org/what-is-the-prefetch-limit-for.html

2009/7/17 janylj <jan...@gmail.com>:
>
> Yes, I am sure that I am using pooled connection factory. And the enqueue and
> dequeue counts changes. But the pending messages cannot be consumed.
>
> Please note that the problem happens a couple of days or weeks after the
> initial deployment. And it went away when we restart the broker.
>
> Thanks a lot.
>
>
> Dejan Bosanac wrote:
>>
>> Hi,
>>
>> are you sure you're using pooled connection factory, since that could
>> cause
>> some problems.
>>
>> http://activemq.apache.org/jmstemplate-gotchas.html
>>
>> You said that you don't see the message in the console, but that message
>> count is incremented. This can happen if your queue is larger than 400
>> messages, since that much is usually browsed. Does enqueue and dequeue
>> counts change as well?
>>
>> Cheers
>> --
>> Dejan Bosanac
>>
>> Open Source Integration - http://fusesource.com/
>> ActiveMQ in Action - http://www.manning.com/snyder/
>> Blog - http://www.nighttale.net
>>
>>
>> On Thu, Jul 9, 2009 at 5:52 PM, janylj <jan...@gmail.com> wrote:
>>
>>>
>>> Sure. I am using ActiveMQ 5.2. I didn't change anything in the
>>> activemq.xml.
>>>
>>> The producer is using Spring JmsTemplate:
>>>
>>> template.send(dest, new MessageCreator() {
>>> public Message createMessage(Session session) throws JMSException {
>>> return session.createTextMessage(dest.toString() + "'s Message #" + cnt);
>>> }
>>> });
>>>
>>> Please note that after restarting ActiveMQ, all previously un-accessible
>>> persistent messages are redelivered and consumed just fine! So I don't
>>> think
>>> it's a persistent journal problem. But somehow ActiveMQ internal state is
>>> corrupted.
>>>
>>> Also the problem does not happen immediately. It usually happens after
>>> having the broker running for a couple of weeks.
>>>
>>> Thanks a lot.
>>>
>>>
>>> Dejan Bosanac wrote:
>>> >
>>> > Hi,
>>> >
>>> > any chance you can send some more details on your setup and a code
>>> sample?
>>> >
>>> > Cheers
>>> > --
>>> > Dejan Bosanac
>>> >
>>> > Open Source Integration - http://fusesource.com/
>>> > ActiveMQ in Action - http://www.manning.com/snyder/
>>> > Blog - http://www.nighttale.net
>>> >
>>> >
>>> > On Wed, Jul 8, 2009 at 12:21 AM, janylj <jan...@gmail.com> wrote:
>>> >
>>> >>
>>> >> I have a broker running ActiveMQ 5.2. After running for a couple of
>>> >> weeks,
>>> >> all persistent messages would NOT be sent successfully. The symptom is
>>> >> that
>>> >> the producer sends message ok (there is no hang or exception in the
>>> >> client
>>> >> side). And the message count in the ActiveMQ admin console is
>>> >> incremented.
>>> >> But the consumer doesn't see any message to consume. Also click into
>>> the
>>> >> queue at the admin console doesn't have any pending message. We know
>>> the
>>> >> consumer is working because all the non-persistent messages are
>>> consumed
>>> >> just fine. And there is no ERROR or WARN in the ActiveMQ log.
>>> >>
>>> >> After restarting the broker, the problem would go away. However, this
>>> >> issue
>>> >> has occurred for a couple of times.
>>> >>
>>> >> Any idea why this happens?
>>> >>
>>> >> Thanks a lot.
>>> >> --
>>> >> View this message in context:
>>> >>
>>> http://www.nabble.com/Cannot-send-any-PERSISTENT-message--tp24382410p24382410.html
>>> >> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>>> >>
>>> >>
>>> >
>>> >
>>> > -----
>>> > Dejan Bosanac
>>> >
>>> > Open Source Integration - http://fusesource.com/
>>> > ActiveMQ in Action - http://www.manning.com/snyder/
>>> > Blog - http://www.nighttale.net
>>> >
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Cannot-send-any-PERSISTENT-message--tp24382410p24412663.html
>>> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>>>
>>>
>>
>>
>> -----
>> Dejan Bosanac
>>
>> Open Source Integration - http://fusesource.com/
>> ActiveMQ in Action - http://www.manning.com/snyder/
>> Blog - http://www.nighttale.net
>>
>
> --
> View this message in context: 
> http://www.nabble.com/Cannot-send-any-PERSISTENT-message--tp24382410p24541430.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
>



-- 
http://blog.garytully.com

Open Source Integration
http://fusesource.com

Reply via email to