camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Raul Kripalani <r...@evosent.com>
Subject Re: how to consume messages by timestamp
Date Tue, 30 Jul 2013 21:29:19 GMT
Agree.

=== Method 2: Camel Aggregation EIP with unique ID correlation expression +
completionTimeout + persistent aggregation repository ===

Use an Aggregate EIP with a correlation expression that picks a unique ID
(e.g. exchangeId), such that aggregation buckets are always of size 1 each
containing one message. With a completionTimeout of 2 minutes, messages
will leave the aggregator once their lifetime reaches 2 minutes (or a bit
later, factoring in the timeout checker interval, etc.).

Make sure you use a Recoverable Aggregation Strategy such as LevelDB, JPA,
SQL, etc. so that no inflight exchanges will be lost in case of a disaster
or scheduled maintenance.

=== Method 3: Use the Scheduling support in ActiveMQ ===

See http://activemq.apache.org/delay-and-schedule-message-delivery.html.

Regards,

*Raúl Kripalani*
Apache Camel PMC Member & Committer | Enterprise Architect, Open Source
Integration specialist
http://about.me/raulkripalani | http://www.linkedin.com/in/raulkripalani
http://blog.raulkr.net | twitter: @raulvk

On Tue, Jul 30, 2013 at 9:39 PM, Christian Posta
<christian.posta@gmail.com>wrote:

> I like Raul's suggestion. It keeps the burden on the broker and the clients
> can be thin and simple.
>
> On the other hand, you could do this on the client side with an aggregator.
> Just consume messages from a queue as quickly as they come in, and let the
> aggregator hold on to them for 2 mins and then release them.
>
>
> On Tue, Jul 30, 2013 at 12:59 PM, Raul Kripalani <raul@evosent.com> wrote:
>
> > I'll explain a possible solution briefly.
> >
> > === Leverage JMS expiration and ActiveMQ individual Dead Letter Queue ===
> >
> > Make your producers send messages with a JMS Time to Live of 2 minutes.
> If
> > you can't change your producers, implement an AMQ Broker Plugin that will
> > set the expiration inside the broker as soon as the message arrives.
> >
> > Set a destinationPolicy for the queue of interest with a custom, and use
> > AMQ's individualDeadLetterStrategy [1] so that expired messages go to a
> > dedicated queue whose name equals the name of the original destination,
> > preceded by the "ActiveMQ.DLQ.Queue." prefix.
> >
> > Build your Camel route to consume from the DLQ instead of from the
> original
> > queue. Your route will only consume messages that are 2 minutes old, or
> > older.
> >
> > Does this help?
> >
> > Regards,
> >
> > *Raúl Kripalani*
> > Apache Camel PMC Member & Committer | Enterprise Architect, Open Source
> > Integration specialist
> > http://about.me/raulkripalani | http://www.linkedin.com/in/raulkripalani
> > http://blog.raulkr.net | twitter: @raulvk
> >
> > On Tue, Jul 30, 2013 at 6:57 AM, shin938 <shalom938@gmail.com> wrote:
> >
> > > I have a simple route spring DSL ,activemq queue. I want to consume
> > > messages
> > > that are 2 minutes old and more. what would be my best approach?
> > >
> > >
> > >
> > > --
> > > View this message in context:
> > >
> >
> http://camel.465427.n5.nabble.com/how-to-consume-messages-by-timestamp-tp5736463.html
> > > Sent from the Camel - Users mailing list archive at Nabble.com.
> > >
> >
>
>
>
> --
> *Christian Posta*
> http://www.christianposta.com/blog
> twitter: @christianposta
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message