You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by noone100 <za...@puzzle.ch> on 2015/05/24 21:49:05 UTC

Discard Obsolete Messages After Redelivery

I'm dealing with messages, that contain updated values for a certain ID. If
such a message can't be  processed, it gets redelivered by the activemq
broker. In the mean time an other message with newer values for the same id
might be enqueued. Since the redelivery delay is quite long it might happen
that the newer message gets processed before the older and the whole process
isn't in the correct order anymore. In that case, the older message should
get discarded to avoid outdated values to override newer values. I thought
about an idempotent consumer, but it does not seem to solve the problem
because it only tracks IDs but not timestamps. Any help would be
appreciated.



--
View this message in context: http://camel.465427.n5.nabble.com/Discard-Obsolete-Messages-After-Redelivery-tp5767439.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Discard Obsolete Messages After Redelivery

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Or use a message filter and implement the logic to detect if the
message id is still valid or not.
http://camel.apache.org/message-filter.html

On Tue, May 26, 2015 at 9:42 AM, Willem Jiang <wi...@gmail.com> wrote:
> I’m afraid you have to implement your version of IdempotentRepository, as the requirement is quite different.
>
> --
> Willem Jiang
>
> Red Hat, Inc.
> Web: http://www.redhat.com
> Blog: http://willemjiang.blogspot.com (English)
> http://jnn.iteye.com (Chinese)
> Twitter: willemjiang
> Weibo: 姜宁willem
>
>
>
> On May 26, 2015 at 3:33:03 PM, noone100 (zaugg+camel@puzzle.ch) wrote:
>> Hi Willem
>>
>> Thanks for your answer!
>>
>> This filter should be able to skip out-of-order messages having the same
>> correlation id but an older timestamp in a persistent manner, that's why I
>> thought about a FileIdempotentRepository but this repo cannot track an id
>> and a timestamp in conjunction. Is there another approach to store an id and
>> a timestamp or is messaging the wrong technique for that problem and I
>> should consider switching to a JPA based approach?
>>
>>
>>
>> --
>> View this message in context: http://camel.465427.n5.nabble.com/Discard-Obsolete-Messages-After-Redelivery-tp5767439p5767458.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/

Re: Discard Obsolete Messages After Redelivery

Posted by Willem Jiang <wi...@gmail.com>.
I’m afraid you have to implement your version of IdempotentRepository, as the requirement is quite different.

--  
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem



On May 26, 2015 at 3:33:03 PM, noone100 (zaugg+camel@puzzle.ch) wrote:
> Hi Willem
>  
> Thanks for your answer!
>  
> This filter should be able to skip out-of-order messages having the same
> correlation id but an older timestamp in a persistent manner, that's why I
> thought about a FileIdempotentRepository but this repo cannot track an id
> and a timestamp in conjunction. Is there another approach to store an id and
> a timestamp or is messaging the wrong technique for that problem and I
> should consider switching to a JPA based approach?
>  
>  
>  
> --
> View this message in context: http://camel.465427.n5.nabble.com/Discard-Obsolete-Messages-After-Redelivery-tp5767439p5767458.html  
> Sent from the Camel - Users mailing list archive at Nabble.com.
>  


Re: Discard Obsolete Messages After Redelivery

Posted by noone100 <za...@puzzle.ch>.
Hi Willem

Thanks for your answer!

This filter should be able to skip out-of-order messages having the same
correlation id but an older timestamp in a persistent manner, that's why I
thought about a FileIdempotentRepository but this repo cannot track an id
and a timestamp in conjunction. Is there another approach to store an id and
a timestamp or is messaging the wrong technique for that problem and I
should consider switching to a JPA based approach?



--
View this message in context: http://camel.465427.n5.nabble.com/Discard-Obsolete-Messages-After-Redelivery-tp5767439p5767458.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Discard Obsolete Messages After Redelivery

Posted by Willem Jiang <wi...@gmail.com>.
Hi,

I think you can consider to write a filter which just tracks the last timestamp (you may need a lock when changing the timestamp).

--  
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem



On May 25, 2015 at 3:49:17 AM, noone100 (zaugg+camel@puzzle.ch) wrote:
> I'm dealing with messages, that contain updated values for a certain ID. If
> such a message can't be processed, it gets redelivered by the activemq
> broker. In the mean time an other message with newer values for the same id
> might be enqueued. Since the redelivery delay is quite long it might happen
> that the newer message gets processed before the older and the whole process
> isn't in the correct order anymore. In that case, the older message should
> get discarded to avoid outdated values to override newer values. I thought
> about an idempotent consumer, but it does not seem to solve the problem
> because it only tracks IDs but not timestamps. Any help would be
> appreciated.
>  
>  
>  
> --
> View this message in context: http://camel.465427.n5.nabble.com/Discard-Obsolete-Messages-After-Redelivery-tp5767439.html  
> Sent from the Camel - Users mailing list archive at Nabble.com.
>