You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by niteshjain <ni...@gmail.com> on 2014/12/12 07:12:27 UTC
Invoking a Router via Java (Processor)
how to invoke a Router in Camel context via a Java code.
Tried this -
in Java Class :
ApplicationContext context = new
ClassPathXmlApplicationContext("*camel_context.xml*");
CamelContext camel = SpringCamelContext.springCamelContext(context);
camel.startRoute("*firstRoute*");
in camel_context.xml :
<bean id="<b>testRoute*"
class="org.apache.camel.processor.RouterTest"/>
<camelContext trace="false" id="TestRouterCamel"
xmlns="http://camel.apache.org/schema/spring">
<route id="<b>firstRoute*">
<from uri="direct:start" />
<to uri="<b>testRoute*" />
</route>
</camelContext>
Trying to invoke firstRoute in camel_context.xml via java class. any help
would be appreciated.
Thanks in advance.
--
View this message in context: http://camel.465427.n5.nabble.com/Invoking-a-Router-via-Java-Processor-tp5760612.html
Sent from the Camel Development mailing list archive at Nabble.com.
AW: Invoking a Router via Java (Processor)
Posted by "Jan Matèrne (jhm)" <ap...@materne.de>.
This is a question for the users list ...
Jan
> -----Ursprüngliche Nachricht-----
> Von: niteshjain [mailto:niteshjain132@gmail.com]
> Gesendet: Freitag, 12. Dezember 2014 07:12
> An: dev@camel.apache.org
> Betreff: Invoking a Router via Java (Processor)
>
> how to invoke a Router in Camel context via a Java code.
>
>
> Tried this -
>
> in Java Class :
>
> ApplicationContext context = new
> ClassPathXmlApplicationContext("*camel_context.xml*");
> CamelContext camel = SpringCamelContext.springCamelContext(context);
> camel.startRoute("*firstRoute*");
>
>
> in camel_context.xml :
>
> <bean id="<b>testRoute*"
> class="org.apache.camel.processor.RouterTest"/>
>
> <camelContext trace="false" id="TestRouterCamel"
> xmlns="http://camel.apache.org/schema/spring">
>
> <route id="<b>firstRoute*">
> <from uri="direct:start" />
> <to uri="<b>testRoute*" />
> </route>
> </camelContext>
>
>
> Trying to invoke firstRoute in camel_context.xml via java class. any
> help would be appreciated.
>
>
> Thanks in advance.
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Invoking-a-Router-via-Java-Processor-
> tp5760612.html
> Sent from the Camel Development mailing list archive at Nabble.com.
Re: Invoking a Router via Java (Processor)
Posted by niteshjain <ni...@gmail.com>.
Thank you very much @Christian.
i was not aware of "Producer Template" as i am a newbie to camel.
That was very helpful :D
--
View this message in context: http://camel.465427.n5.nabble.com/Invoking-a-Router-via-Java-Processor-tp5760612p5760681.html
Sent from the Camel Development mailing list archive at Nabble.com.
Re: Invoking a Router via Java (Processor)
Posted by Christian Schneider <ch...@die-schneider.net>.
Check http://camel.apache.org/producertemplate.html
You can call the direct:start endpoint with it.
Christian
On 12.12.2014 07:12, niteshjain wrote:
> how to invoke a Router in Camel context via a Java code.
>
>
> Tried this -
>
> in Java Class :
>
> ApplicationContext context = new
> ClassPathXmlApplicationContext("*camel_context.xml*");
> CamelContext camel = SpringCamelContext.springCamelContext(context);
> camel.startRoute("*firstRoute*");
>
>
> in camel_context.xml :
>
> <bean id="<b>testRoute*"
> class="org.apache.camel.processor.RouterTest"/>
>
> <camelContext trace="false" id="TestRouterCamel"
> xmlns="http://camel.apache.org/schema/spring">
>
> <route id="<b>firstRoute*">
> <from uri="direct:start" />
> <to uri="<b>testRoute*" />
> </route>
> </camelContext>
>
>
> Trying to invoke firstRoute in camel_context.xml via java class. any help
> would be appreciated.
>
>
> Thanks in advance.
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Invoking-a-Router-via-Java-Processor-tp5760612.html
> Sent from the Camel Development mailing list archive at Nabble.com.
--
Christian Schneider
http://www.liquid-reality.de
Open Source Architect
http://www.talend.com