activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From spiiff <>
Subject Re: receiving old messages when restartin embedded broker - problem with persistence/auto_acknowledge?
Date Fri, 26 Oct 2007 12:40:01 GMT

Hi Henning,
we are using the latest stable version: apache-activemq-4.1.1 and an oracle
But in the newest unstable version (5x) the DefaultJDBCDAdapter class still
has this bug inside.
If you have the source code of 3.2.2 available you can check the method
.doSetLastAck()  inside the DefaultJDBCDAdapter class.
It was not very complicated for us to reproduce this problem. It's important
that you use durable subscriptions:
MessageConsumer consumer = ((TopicSession) session).createDurableSubscriber(
			       (Topic) destination, subscriberName);
You create some consumers and one producer, send some messages and receive
them, close (not unsubscribe) the consumers. Send some messages again. Close
the producer. Close the sessions. Shut down the broker. (We're using an
embedded one, very nice for unittests).
If you start the test again one consumer gets the correct messages, the
other one gets them all.
To better understand the behaviour look inside the database table
ACTIVEMQ_ACKS and watch the LAST_ACKED_ID. After shutdown, only one is


Henning Sprang wrote:
> Hi Matthias,
> spiiff wrote:
>> Turning off the batchedStatements did not really solve the problem.
>> Here is a bug description (from Jul 04, 2006 ! ):
>> I think this was the reason for our problem..
>> With this correction in the DefaultJDBCAdapter.doSetLastAck() :
>> PreparedStatement s=c.getUpdateLastAckStatement();
>>         	//c.getAddMessageStatement();
>> our code works as expected...
>> Why was this bug not solved before?
>> Will it be solved with version 4.2?
>> Is this bug already tracked somewhere? How can I check this?
> It seems I am hit by the very same problem - I didn't find your post
> because I rather searched for "resend", "resent" and such things, but
> not receieving old messages.
> So I also asked a question about similar effects some days a go, but got
> no reply.
> I wonder, in which version do you have these effects(I have 3.2.2), and
> with which database?
> I am still not able to reproduce the problem - it only happened to us in
> production, but i don't get it happening on purpose - the very first
> step I need to fulfil before trying any fixes. I tried your code (adding
> some complettion to the fragments you sent here), aqnd an own test case,
> but until now, I only get all messages exactly once - no resending after
> the restart of the broker.
> Thanks in advance,
> Henning

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

View raw message