You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Fitzcaraldo <Br...@marlo.com.au> on 2012/03/05 01:01:53 UTC

Accessing Endpoint within bean

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.

Re: Accessing Endpoint within bean

Posted by Willem <wi...@gmail.com>.
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.


Re: Accessing Endpoint within bean

Posted by Willem Jiang <wi...@gmail.com>.
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