I'm trying to flesh out a prototype based on the Recipient List EIP. I've got a number of routes that I want to be able to configure on the fly based on various parameters stored in a database. My rough design is to store <endpoint:uri> pairs in an in-memory map. This mapping will be kept in sync as the database values change.
For my prototype, I'm attempting to set up a basic service that loads up a couple of logging endpoints using the Java DSL. The Routebuilder is used to generate the routes initially using the recipientList().method() notation where the method contains a bean call to a method that accesses the in-memory mapping based on the 'from endpoint' (exchange.getFromEndpoint().getEndpointUri()). The service is instantiated with a unit test suite and I've confirmed that things get setup correct. I'm able to generate the logging routes via the DSL and send a message to them directly as part of the unit test. Check. However, I've run into trouble when I attempt to create a route that subsequently calls to a logging route which was generated with the Java DSL. (Through various combinations/trial and error, I've confirmed that when I statically define the logging routes with Spring XML rather than Java DSL I have no issue.) Is there a difference in how routes are accessed depending on the method used to define them (Java DSL vs Spring XML)? Below is the behavior I see when using only the Java DSL which fails: <route setup logging output -- everything looks ok> . . . 014-07-14 14:15:47,383 DEBUG DirectProducer - Starting producer: Producer[direct://route1] 2014-07-14 14:15:47,384 DEBUG ProducerCache - Adding to producer cache with key: Endpoint[direct://route1] for producer: Producer[direct://route1] 2014-07-14 14:15:47,386 DEBUG ProducerCache - >>>> Endpoint[direct://route1] Exchange[Message: test message 1] 2014-07-14 14:15:47,431 DEBUG ProtoService - ProtoService.TestBean.testMethod 2014-07-14 14:15:47,432 DEBUG ProtoService - ...endpoint value=direct:route1, target=direct:consumer1 2014-07-14 14:15:47,433 DEBUG BeanProcessor - Setting bean invocation result on the OUT message: direct:consumer1 2014-07-14 14:15:47,438 DEBUG DirectProducer - Starting producer: Producer[direct://consumer1] 2014-07-14 14:15:47,439 DEBUG ProducerCache - Adding to producer cache with key: Endpoint[direct://consumer1] for producer: Producer[direct://consumer1] 2014-07-14 14:15:47,443 DEBUG DefaultErrorHandler - Redelivery enabled: false on error handler: DefaultErrorHandler[Producer[direct://consumer1]] 2014-07-14 14:15:47,446 DEBUG ProtoService - ProtoService.TestBean.testMethod 2014-07-14 14:15:47,448 DEBUG ProtoService - ...endpoint value=direct:route1, target=direct:consumer1 2014-07-14 14:15:47,449 DEBUG BeanProcessor - Setting bean invocation result on the OUT message: direct:consumer1 2014-07-14 14:15:47,450 DEBUG DirectProducer - Starting producer: Producer[direct://consumer1] 2014-07-14 14:15:47,502 DEBUG ProducerCache - Adding to producer cache with key: Endpoint[direct://consumer1] for producer: Producer[direct://consumer1] 2014-07-14 14:15:47,503 DEBUG DefaultErrorHandler - Redelivery enabled: false on error handler: DefaultErrorHandler[Producer[direct://consumer1]] . . . <this continues looping like this for about 700 lines> . . . 2014-07-14 14:15:50,625 DEBUG MulticastProcessor - Message exchange has failed: Sequential processing failed for number 0 for exchange: Exchange[Message: test message 1] Exception: org.apache.camel.CamelExecutionException: Exception occurred during execution on the exchange: Exchange[Message: test message 1] 2014-07-14 14:15:50,626 DEBUG MulticastProcessor - Done sequential processing 1 exchanges 2014-07-14 14:15:50,628 DEBUG MulticastProcessor - Message exchange has failed: Sequential processing failed for number 0 for exchange: Exchange[Message: test message 1] Exception: org.apache.camel.CamelExecutionException: Exception occurred during execution on the exchange: Exchange[Message: test message 1] 2014-07-14 14:15:50,629 DEBUG MulticastProcessor - Done sequential processing 1 exchanges 2014-07-14 14:15:50,630 DEBUG MulticastProcessor - Message exchange has failed: Sequential processing failed for number 0 for exchange: Exchange[Message: test message 1] Exception: org.apache.camel.CamelExecutionException: Exception occurred during execution on the exchange: Exchange[Message: test message 1] 2014-07-14 14:15:50,631 DEBUG MulticastProcessor - Done sequential processing 1 exchanges 2014-07-14 14:15:50,632 DEBUG MulticastProcessor - Message exchange has failed: Sequential processing failed for number 0 for exchange: Exchange[Message: test message 1] Exception: org.apache.camel.CamelExecutionException: Exception occurred during execution on the exchange: Exchange[Message: test message 1] 2014-07-14 14:15:50,633 DEBUG MulticastProcessor - Done sequential processing 1 exchanges 2014-07-14 14:15:50,634 DEBUG MulticastProcessor - Message exchange has failed: Sequential processing failed for number 0 for exchange: Exchange[Message: test message 1] Exception: org.apache.camel.CamelExecutionException: Exception occurred during execution on the exchange: Exchange[Message: test message 1] 2014-07-14 14:15:50,634 DEBUG MulticastProcessor - Done sequential processing 1 exchanges . . . <also continues looping for the same number of attempts> . . . Ultimately, the exchange returns with isFailure() returning true and my test exits in a failure. Can anyone point out what might be going on here? Thanks. -- View this message in context: http://camel.465427.n5.nabble.com/Recipient-List-Help-Routes-defined-with-Java-DSL-vs-Spring-XML-tp5753794.html Sent from the Camel - Users mailing list archive at Nabble.com.