James, thanks for the suggestion - I'll try that, however, I would still like to know if/how a given endpoint can programmtically find the next down-stream endpoint in a route...

On 10/4/2013 1:38 PM, James Carman wrote:
Does a splitter not work for you in this case?

On Fri, Oct 4, 2013 at 1:28 PM, Chris <cwolf.a...@gmail.com> wrote:
Hello,

I implemented a bean whose method accepts an exchange with a single message,
then generates multiple messages intended for the next endpoint down-stream,
along the lines of this:

http://camel.apache.org/how-do-i-write-a-custom-processor-which-sends-multiple-messages.html


However, I'd like to avoid having to explicitly configure the endpoint in
the bean's ProducerTemplate if it can be found in the route definition.

In other words, if I have:

from("direct:start")
.enrich("bean:MyBean")
.to("mock:result");  <<< this should be sufficient to indicate producer
target URI.

...and MyBean is:

public MyBean {
   protected ProducerTemplate producer;
   public void businessLogic(Exchange exchange) {
       if (producer == null) {
           producer = exchange.createProducerTemplate();
           producer.setDefaultEndpointUri("mock:result"); <<< Why should I
have to do this?  I just want it to go to the next down-stream endpoint in
the pipeline, already defined in the route!!<<<<
       }
       [...bla, bla, bla...]
       while (hasStuffToSend) {
           producer.setBody(stuff[i]);
       }
   }
}


Reply via email to