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