Re: Java DSL: How to inject object endpoint?
I'll look into this, thanks. Regards, Allan C. On Tue, Nov 1, 2016 at 10:21 PM, Brad Johnsonwrote: > You may also want to look at @EndpointInject with uri of the route you want > to invoke. That depends on the specific needs. You might use that in the > case where you want to iterate over items in a list, mutate some data or > filter items and find it easier to do in a Java POJO than in the route > builder or XML. In that case the injection of the endpoint will permit you > to invoke the next route from your Java code. > > I recently had a case where I received a List of items from a REST/SOAP > route and needed to make sure that all the items were valid before sending > back an OK or a rejection. All the beans in the list had to be valid or > none of them could be processed. It could have been done in blueprint but > it would have been a bit more fiddly and not as easy to unit test. > > That's the nice thing about Camel is it permits different mechanisms. > > On Mon, Oct 31, 2016 at 11:24 PM, Allan C. wrote: > > > Noted, thanks for the tips! > > > > Regards, > > Allan C. > > > > On Tue, Nov 1, 2016 at 12:11 PM, Tomohisa Igarashi < > tm.igara...@gmail.com> > > wrote: > > > > > Or migrate to @Named("someInstance") CDI bean with using camel-cdi? > > > http://camel.apache.org/cdi.html > > > > > > > > > On 11/01/2016 01:04 PM, Minh Tran wrote: > > > > > >> Hi > > >> > > >> It’s still the same syntax > > >> > > >> from("foo://bar?foobar=#someInstance”).to (…. > > >> > > >> You still declare the someInstance somewhere in your Spring context as > > >> you would have previously using xml DSL > > >> > > >> On 1 Nov 2016, at 3:01 PM, Allan C. wrote: > > >>> > > >>> P/S I am using RouteBuilder > > >>> > > >>> Regards, > > >>> Allan C. > > >>> > > >>> On Tue, Nov 1, 2016 at 11:58 AM, Allan C. > wrote: > > >>> > > >>> Hi, > > > > I've never used Java DSL to define routes. Can anyone share or > provide > > some hints on how to perform the same thing below in Java code? i.e. > > inject > > someInstance into the endpoint. > > > > > > > > Regards, > > Allan C. > > > > > > >> > > >
Re: Java DSL: How to inject object endpoint?
You may also want to look at @EndpointInject with uri of the route you want to invoke. That depends on the specific needs. You might use that in the case where you want to iterate over items in a list, mutate some data or filter items and find it easier to do in a Java POJO than in the route builder or XML. In that case the injection of the endpoint will permit you to invoke the next route from your Java code. I recently had a case where I received a List of items from a REST/SOAP route and needed to make sure that all the items were valid before sending back an OK or a rejection. All the beans in the list had to be valid or none of them could be processed. It could have been done in blueprint but it would have been a bit more fiddly and not as easy to unit test. That's the nice thing about Camel is it permits different mechanisms. On Mon, Oct 31, 2016 at 11:24 PM, Allan C.wrote: > Noted, thanks for the tips! > > Regards, > Allan C. > > On Tue, Nov 1, 2016 at 12:11 PM, Tomohisa Igarashi > wrote: > > > Or migrate to @Named("someInstance") CDI bean with using camel-cdi? > > http://camel.apache.org/cdi.html > > > > > > On 11/01/2016 01:04 PM, Minh Tran wrote: > > > >> Hi > >> > >> It’s still the same syntax > >> > >> from("foo://bar?foobar=#someInstance”).to (…. > >> > >> You still declare the someInstance somewhere in your Spring context as > >> you would have previously using xml DSL > >> > >> On 1 Nov 2016, at 3:01 PM, Allan C. wrote: > >>> > >>> P/S I am using RouteBuilder > >>> > >>> Regards, > >>> Allan C. > >>> > >>> On Tue, Nov 1, 2016 at 11:58 AM, Allan C. wrote: > >>> > >>> Hi, > > I've never used Java DSL to define routes. Can anyone share or provide > some hints on how to perform the same thing below in Java code? i.e. > inject > someInstance into the endpoint. > > > > Regards, > Allan C. > > > >> >
Re: Java DSL: How to inject object endpoint?
Noted, thanks for the tips! Regards, Allan C. On Tue, Nov 1, 2016 at 12:11 PM, Tomohisa Igarashiwrote: > Or migrate to @Named("someInstance") CDI bean with using camel-cdi? > http://camel.apache.org/cdi.html > > > On 11/01/2016 01:04 PM, Minh Tran wrote: > >> Hi >> >> It’s still the same syntax >> >> from("foo://bar?foobar=#someInstance”).to (…. >> >> You still declare the someInstance somewhere in your Spring context as >> you would have previously using xml DSL >> >> On 1 Nov 2016, at 3:01 PM, Allan C. wrote: >>> >>> P/S I am using RouteBuilder >>> >>> Regards, >>> Allan C. >>> >>> On Tue, Nov 1, 2016 at 11:58 AM, Allan C. wrote: >>> >>> Hi, I've never used Java DSL to define routes. Can anyone share or provide some hints on how to perform the same thing below in Java code? i.e. inject someInstance into the endpoint. Regards, Allan C. >>
Re: Java DSL: How to inject object endpoint?
Or migrate to @Named("someInstance") CDI bean with using camel-cdi? http://camel.apache.org/cdi.html On 11/01/2016 01:04 PM, Minh Tran wrote: Hi It’s still the same syntax from("foo://bar?foobar=#someInstance”).to (…. You still declare the someInstance somewhere in your Spring context as you would have previously using xml DSL On 1 Nov 2016, at 3:01 PM, Allan C.wrote: P/S I am using RouteBuilder Regards, Allan C. On Tue, Nov 1, 2016 at 11:58 AM, Allan C. wrote: Hi, I've never used Java DSL to define routes. Can anyone share or provide some hints on how to perform the same thing below in Java code? i.e. inject someInstance into the endpoint. Regards, Allan C.
Re: Java DSL: How to inject object endpoint?
I see. Noted, thanks! Regards, Allan C. On Tue, Nov 1, 2016 at 12:04 PM, Minh Tranwrote: > Hi > > It’s still the same syntax > > from("foo://bar?foobar=#someInstance”).to (…. > > You still declare the someInstance somewhere in your Spring context as you > would have previously using xml DSL > > > On 1 Nov 2016, at 3:01 PM, Allan C. wrote: > > > > P/S I am using RouteBuilder > > > > Regards, > > Allan C. > > > > On Tue, Nov 1, 2016 at 11:58 AM, Allan C. wrote: > > > >> Hi, > >> > >> I've never used Java DSL to define routes. Can anyone share or provide > >> some hints on how to perform the same thing below in Java code? i.e. > inject > >> someInstance into the endpoint. > >> > >> > >> > >> Regards, > >> Allan C. > >> > >
Re: Java DSL: How to inject object endpoint?
Hi It’s still the same syntax from("foo://bar?foobar=#someInstance”).to (…. You still declare the someInstance somewhere in your Spring context as you would have previously using xml DSL > On 1 Nov 2016, at 3:01 PM, Allan C.wrote: > > P/S I am using RouteBuilder > > Regards, > Allan C. > > On Tue, Nov 1, 2016 at 11:58 AM, Allan C. wrote: > >> Hi, >> >> I've never used Java DSL to define routes. Can anyone share or provide >> some hints on how to perform the same thing below in Java code? i.e. inject >> someInstance into the endpoint. >> >> >> >> Regards, >> Allan C. >>
Re: Java DSL: How to inject object endpoint?
P/S I am using RouteBuilder Regards, Allan C. On Tue, Nov 1, 2016 at 11:58 AM, Allan C.wrote: > Hi, > > I've never used Java DSL to define routes. Can anyone share or provide > some hints on how to perform the same thing below in Java code? i.e. inject > someInstance into the endpoint. > > > > Regards, > Allan C. >
Java DSL: How to inject object endpoint?
Hi, I've never used Java DSL to define routes. Can anyone share or provide some hints on how to perform the same thing below in Java code? i.e. inject someInstance into the endpoint. Regards, Allan C.