On Mon, Apr 8, 2013 at 7:56 PM, Tarun Kumar <agrawal.taru...@gmail.com>wrote:

> Here's what i am doing:
>
> I have written one JAX-RS service which when invoked creates CamelContext,
> adds this route to CamelContext, Create ProducerTemplate, calls
> pt.sendBody() method and then starts CamelContext.
>

Ok, first thing is you need to start your context (which starts the routes)
before you can use a producer template to send a message to it. Starting
the context is what creates and publishes the endpoints so that they can
receive messages. If the context isn't started there is no "direct:start"
endpoint deployed which is the error you are getting.

>From an architectural point of view, starting a new context on every web
request probably isn't the best idea. It looks like you are developing a
web proxy (receive on one endpoint and send to another web service) so
might I suggest that instead of hosting a camel route inside a JAX-RS
service you have a camel app that has a JAX-RS endpoint as the entry? That
way you have one route that is reused many times. In your current approach,
how are you stopping the contexts/routes and cleaning up resources?

>
> Tarun
>
>
> On Tue, Apr 9, 2013 at 8:19 AM, Chris Geer <ch...@cxtsoftware.com> wrote:
>
> > On Mon, Apr 8, 2013 at 7:45 PM, Tarun Kumar <agrawal.taru...@gmail.com
> > >wrote:
> >
> > > My camel route is :
> > >
> > > from("direct:start")
> > > .to("http://myhost/mypath";);
> > >
> > > I used :
> > >
> > > ProducerTemplate template;
> > > template.sendBody("direct:start", "This is a test message");
> > >
> > > to send the exchange. I am getting following exception:
> > >
> > > No consumers available on endpoint: Endpoint[direct://start].
> > >
> > > How can i receive the same exchange in direct:start endpoint?
> > >
> >
> > How are you running your application? Standalone camel application from
> > main() or OSGI bundle? Assuming it's a stand alone application did you
> make
> > sure and start your context?
> >
> > >
> > >
> > > Tarun
> > >
> >
>

Reply via email to