If you should not loose messages, you should use a transacted route and leverage on the ActiveMQ redelivery capabilities [1].
[1] http://activemq.apache.org/redelivery-policy.html Best, Christian On Mon, Jun 4, 2012 at 9:51 PM, gramanero <graman...@gmail.com> wrote: > I'm wondering if there are any sort of best practices or pros/cons to using > either the dead letter queue or transactions when errors occur while > pulling > off messages from a queue and attempting to route them to a cxfrs endpoint > that may not be available. > > For example, say I have the following route: > > <route id="myRoute" startupOrder="1" > > <from uri="activemq:queue:myQueue"/> > <to uri="cxfrs:http://localhost:9999/MyService" pattern="InOnly"/> > </route> > > I have played around with using the dead letter queue and that seems to > work > well, but then I started to think about getting the messages off the dead > letter queue and putting them back onto myQueue for processing once the > service becomes available. One way to accomplish this (possibly) is to use > the CronScheduledRoutePolicy such that it wakes up every hour and starts a > route that will pull messages off the dead letter queue (if there are any), > put them onto the myQueue and then stop the route after N number of > minutes. > I'm not sure that this is a good idea, but it "one" way to build a more > auto-maintained system. Seems like once I start getting into configuring > the > CronScheduledRoutePolicy that the solution becomes more complex then it > really needs to be in terms of the various moving parts. > > The other thought is to use the ActiveMQ transaction manager. If the cxfrs > endpoint is not available, then the transaction rolls back which puts the > message back on the queue (or just never really pulls it off) and then > waits > a while (via a delay configuration) and tries to route the message again. > One thing I don't really like about this is that if the service is down for > a long period of time, then it seems like we will be in this mode where > messages are constantly trying to be routed to the unavailable cxfrs > endpoint thus sort of thrashing the system. > > I'm just looking for some opinions to how this type of problem is typically > solved or some sort of best practice to this use case. > > Thanks! > > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Transacted-vs-DeadLetterQueue-tp5713992.html > Sent from the Camel - Users mailing list archive at Nabble.com. >