Anyone know how to configure JMS as a dead letter channel but in a
transaction? Should be a simple issue I would think but its not working.
final String fromURI =
String.format("activemq:queue:%s?concurrentConsumers=%d",
config.basicRouteInboxQueue(),
config.concurrentConsumers());
errorHandler(deadLetterChannel("activemq:queue:ea.automation.dead").maximumRedeliveries(0));
// The comments on the end of route steps help in reading code and
force the code formatter to behave.
from(fromURI).routeId(ROUTE_ID_BASIC_ROUTE) // read from the inbox in
ActiveMQ
.transacted(KEY_TXNPOLICY_REQUIRED) // make the route transacted.
.setHeader(HDR_REQUESTOR, constant(config.requestor())) // we will
use the context name as the the requester
.to("activemq:queue:" + config.basicRouteOutboxQueue()).id("end")
.process(new Processor() {
@Override
public void process(final Exchange exchange) throws Exception {
throw new RuntimeException("Forced exception");
}
});
This causes the resulting message to end up in BOTH the dead letter channel
and the outbox, which is of course not desired.
Thanks in advance.
*Robert Simmons Jr. MSc. - Lead Java Architect @ EA*
*Author of: Hardcore Java (2003) and Maintainable Java (2012)*
*LinkedIn: **http://www.linkedin.com/pub/robert-simmons/40/852/a39
<http://www.linkedin.com/pub/robert-simmons/40/852/a39>*