One solution is to parametrize the downstream endpoint in the Registry.

from("...").process(new MyProcessor()).to(myDownstreamEndpoint);

where myDownstreamEndpoint is a bean property of type String that gets
injected via Spring or Blueprint during the route initialization.

It should always have the same bean name in all contexts, e.g.
("myDownstreamEndpoint"), so then from MyProcessor you can do the following
lookup:

String uri = exchange.getRegistry().lookup("myDownstreamEndpoint",
String.class);

The condition is, of course, that all Camel Contexts using this processor
must have this property in their Application/Blueprint Contexts.

Hope that helps,

*Raúl Kripalani*
Enterprise Architect, Open Source Integration specialist, Program
Manager | Apache
Camel Committer
http://about.me/raulkripalani | http://www.linkedin.com/in/raulkripalani
http://blog.raulkr.net | twitter: @raulvk

On Fri, Apr 12, 2013 at 4:36 PM, Chris Wolf <cwolf.a...@gmail.com> wrote:

> The reason I asked is because now I have to set default Endpoint or URI in
> the producer template - it would be nice if the default setting would be
> the next down-stream endpoint.
>
>
> On Thu, Apr 11, 2013 at 8:53 PM, Willem jiang <willem.ji...@gmail.com
> >wrote:
>
> > ProducerTemplate can send the exchange to any other endpoints.
> > Processor is decoupled with the camel route, I don't think you can get
> the
> > downstream endpoint from the custom Processor itself.
> >
> >
> > --
> > Willem Jiang
> >
> > Red Hat, Inc.
> > FuseSource is now part of Red Hat
> > Web: http://www.fusesource.com | http://www.redhat.com
> > Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/)
> > (English)
> >           http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
> > Twitter: willemjiang
> > Weibo: 姜宁willem
> >
> >
> >
> >
> >
> > On Friday, April 12, 2013 at 8:08 AM, Chris Wolf wrote:
> >
> > > Hello,
> > >
> > > I'm implementing a custom Processor - it will have a ProducerTemplate,
> > > which will always
> > > send to the next Endpoint, downstream - why do I have to set the
> > > defaultEndpoint
> > > or defaultEndpointURI? That guarantees hardcoding. Isn't there someway
> to
> > > indicate,
> > > upon CamelContext.createProducerTemplate() to imply next downstream
> > > Endpoint?
> > >
> > > It's not a show-stopper, I can explicitly configure the Producer
> > > defaultEndpoint, but I don't
> > > know why it can't default to the next down-stream consuming endpoint...
> > >
> > > Thanks,
> > >
> > > Chris
> >
> >
> >
>

Reply via email to