[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: How to use InterceptSendToEndpoint from Java DSL

I think there is something wrong with our camel context. Not sure what.
We were creating a camel context in blueprints [karaf 4.1.4] using the <camelContext> tag, and then trying to replace the activemq component with a new one with a failover() url in java (removeComponent('activemq'), addComponent('activemq')), however when the camel context was started the wrong activemq was used.
So, I switched the blueprint to construct a camel context by doing the something like the following:
<bean class="DefaultCamelContext">, then in the java I set a 'mymq' component with a sub class of the activemq component that creates a SendToIntercept endpoint as needed.
That works, not ideal. However, now the error handler that I am creating via Java DSL does not appear to fire when a failure occurs on the route.
Any ideas what might be missing on the camel context created that way such that the interceptors and error handlers do not seem to register correctly?

From: Jackson, Douglas (DF PL LCS CF SEPL SEF ING)
Sent: Friday, June 8, 2018 12:17 PM
To: users@xxxxxxxxxxxxxxxx
Subject: RE: How to use InterceptSendToEndpoint from Java DSL

Thanks so much for responding.  It is awesome to have someone of your caliber answering my questions!

> Ah okay yeah you can have it in one route builder, where you can have
> all your interceptors. Then during startup it will re-register any
> existing endpoints with itself so it can proxy/detour.
My initial attempt was to create a RouteBuilder and in the configure method call the interceptSendToEndpoint() method a few times.

      camelContext.addRoutes(new RouteBuilder() {
               public void configure()
               throws Exception {
However, the queued-interceptor route was never fired when a message was posted to activemq.
So I assumed that those interceptors were not acting beyond the context of the route.