Quantcast

Accessing Endpoint within bean

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Accessing Endpoint within bean

Fitzcaraldo
Hi

I want to develop a bean that will write a copy of the message at various points passing through a Camel route.  Something like as follows:

from(foo:bar).bean("MyClass", "input")
.to(foo:bar).bean("MyClass", "output")

Inside the MyClass bean I want to be able to write to a jms log queue.  Is there anyway I can leverage an camel endpoint to do that or do I need to use raw JMS?  If JMS is the anyway I can get hold of the existing JMS connection?

Thanks
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Accessing Endpoint within bean

Willem.Jiang
Hi,

You can take a look at the ProducerTemplate[1] which can be used directly in your bean class.

[1]http://camel.apache.org/producertemplate.html

Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog: http://willemjiang.blogspot.com (English)
          http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang

On Mar 5, 2012, at 8:01 AM, Fitzcaraldo wrote:

> Hi
>
> I want to develop a bean that will write a copy of the message at various
> points passing through a Camel route.  Something like as follows:
>
> from(foo:bar).bean("MyClass", "input")
> .to(foo:bar).bean("MyClass", "output")
>
> Inside the MyClass bean I want to be able to write to a jms log queue.  Is
> there anyway I can leverage an camel endpoint to do that or do I need to use
> raw JMS?  If JMS is the anyway I can get hold of the existing JMS
> connection?
>
> Thanks
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Accessing-Endpoint-within-bean-tp5536081p5536081.html
> Sent from the Camel - Users mailing list archive at Nabble.com.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Accessing Endpoint within bean

Willem.Jiang
In reply to this post by Fitzcaraldo
You may consider to inject a ProducerTemplate into t your bean like
this[1]

Then you can send the message to the JMS endpoint as you want.

[1]http://camel.apache.org/pojo-producing.html

On Mon Mar  5 08:01:53 2012, Fitzcaraldo wrote:

> Hi
>
> I want to develop a bean that will write a copy of the message at various
> points passing through a Camel route.  Something like as follows:
>
> from(foo:bar).bean("MyClass", "input")
> .to(foo:bar).bean("MyClass", "output")
>
> Inside the MyClass bean I want to be able to write to a jms log queue.  Is
> there anyway I can leverage an camel endpoint to do that or do I need to use
> raw JMS?  If JMS is the anyway I can get hold of the existing JMS
> connection?
>
> Thanks
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Accessing-Endpoint-within-bean-tp5536081p5536081.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



--
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
         http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang

Loading...