You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by s-bolz <s-...@web.de> on 2006/12/12 13:29:14 UTC

How can I use session recovery with a (Spring) DefaultMessageListenerContainer?

Hi,

I have searched the web for the whole morning now and couldn't find a way to
solve my problem. So maybe anyone from you can help.

I use a org.springframework.jms.listener.DefaultMessageListenerContainer as
a Container for each Message Listener, I have set up durable Subscriptions,
and use CLIENT_ACKNOWLEDGE mode.

My listeners gather their messages in a batch and after the batch has
reached a certain size (1000) write them into a database. After the batch
has been written the messages are acknowledged (and the batch cleared of
course).

The point is, that if the listeners shut down (planned or unplanned) there
might still exist some unprocessed messages. After restart they shall be
sent again to the Listeners so that they can then be processed and written
into the database.

I have found out that I need to use session.recover() after the restart of
the listeners. But since I use the DefaultMessageListenerContainer I cannot
access the session directly.

I know, this looks more like a Spring problem and I have posted the question
there as well, but I still would like to know your oppinion. Maybe my
approach can be optimized or someone can even think of a workaround.

Any help / suggestions / links would be highly appreciated.

Thanks!
Sebastian
-- 
View this message in context: http://www.nabble.com/How-can-I-use-session-recovery-with-a-%28Spring%29-DefaultMessageListenerContainer--tf2807243.html#a7832261
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: How can I use session recovery with a (Spring) DefaultMessageListenerContainer?

Posted by James Strachan <ja...@gmail.com>.
I'd try the Spring forum as this is an issue for the Spring code

On 12/12/06, s-bolz <s-...@web.de> wrote:
>
> Hi,
>
> I have searched the web for the whole morning now and couldn't find a way to
> solve my problem. So maybe anyone from you can help.
>
> I use a org.springframework.jms.listener.DefaultMessageListenerContainer as
> a Container for each Message Listener, I have set up durable Subscriptions,
> and use CLIENT_ACKNOWLEDGE mode.
>
> My listeners gather their messages in a batch and after the batch has
> reached a certain size (1000) write them into a database. After the batch
> has been written the messages are acknowledged (and the batch cleared of
> course).
>
> The point is, that if the listeners shut down (planned or unplanned) there
> might still exist some unprocessed messages. After restart they shall be
> sent again to the Listeners so that they can then be processed and written
> into the database.
>
> I have found out that I need to use session.recover() after the restart of
> the listeners. But since I use the DefaultMessageListenerContainer I cannot
> access the session directly.
>
> I know, this looks more like a Spring problem and I have posted the question
> there as well, but I still would like to know your oppinion. Maybe my
> approach can be optimized or someone can even think of a workaround.
>
> Any help / suggestions / links would be highly appreciated.
>
> Thanks!
> Sebastian
> --
> View this message in context: http://www.nabble.com/How-can-I-use-session-recovery-with-a-%28Spring%29-DefaultMessageListenerContainer--tf2807243.html#a7832261
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
>


-- 

James
-------
http://radio.weblogs.com/0112098/