Shared Camel ActiveMQ Component throws "java.lang.IllegalStateException - SendProcessor has not been started: sendTo(Endpoint[activemq://queue:errorQueue]" error
Issue
An ActiveMQ component is shared among multiple routes. Stopping one route will generate "java.lang.IllegalStateException - SendProcessor has not been started: sendTo(Endpoint[activemq://queue:errorQueue]" when attempting to use the component in another route.
For instance:
public class MyRouteBuilder extends SpringRouteBuilder {
@Override
public void configure() throws Exception {
onException(Exception.class).id("Base Exception Handler")
.useOriginalMessage()
.setHeader("DLQReason", simple("${exception.message}")).id("Exception DLC")
.handled(true)
.loadBalance().roundRobin()
.to("activemq:queue:errorQueue").id("Exception to Queue")
.end()
.stop();
from("activemq:queue:primaryQueue", "seda:reprocess").routeId("PrimaryRoute").autoStartup(true)
.process(new Processor() {
public void process(Exchange exchange) throws Exception {
String body = exchange.getIn().getBody(String.class);
if(body.contains("error")) {
throw new Exception("Forced Exception");
}
}
})
.log("Recieved Message: ${body}");
from("activemq:queue:errorQueue").routeId("ErrorReprocessRoute").autoStartup(true)
.log(LoggingLevel.DEBUG, "Reprocessing Error")
.process(new StopCurrentRouteProcessor("ErrorReprocessRoute"))
.to("seda:reprocess");
}
}
Environment
- JBoss Fuse
- 6.1
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.