I tried <from ref="myBean"/>  and I got the exception:

Caused by: org.apache.camel.NoSuchEndpointException: No endpoint could be found 
for: ref:consumerBean, please check your camel registry with id consumerBean

By looking into the code, I figured out that the bean must be an Endpoint 
(which was not my case).

So I guess it's easier and cleaner to create a custom Camel Component.

Thank you for your answers Claus.
From: Claus Ibsen-2 [via Camel] [mailto:ml-node+s465427n574358...@n5.nabble.com]
Sent: mercredi 20 novembre 2013 21:16
To: VANSILIETTE Florent
Subject: Re: Consume from a java bean

Ah okay, yeah you can do from(bean) but then Camel will just keep
calling the method on the bean in endless loop, using a single
threaded consumer.
So if there is no messages on the JMS queue to process you would need
to sleep the thread or something as there is no message for Camel to
route.

You can also just have a from direct and then from whatever bean you
have send a message to that direct endpoint for Camel route.


On Wed, Nov 20, 2013 at 9:00 PM, flovansi <[hidden 
email]</user/SendEmail.jtp?type=node&node=5743588&i=0>> wrote:

>
>
>
>
>
> I m not sure it'll be possible with the @Consume annotation.
>
>
> I want to be able to create an exchange in the POJO and to manage manually 
> the JMS transaction when consuming message.
> If I've well understood, the @Consume annotation cannot fit in this case as 
> we have to specify an endpoint to consume from.
>
>
> Thank you for your answer anyway and please correct me if I'm wrong.
>
>
> Florent
>
> On 20 nov. 2013, at 17:33, &quot;Claus Ibsen-2 [via Camel]&quot; &lt; 
> ml-node&#43;[hidden email]</user/SendEmail.jtp?type=node&node=5743588&i=1> 
> &gt; wrote:
>
>
>
> Hi
>
> Yeah see
> http://camel.apache.org/pojo-messaging-example.html
>
> You dont need a route if you use a pojo with the @Consume annotation
> as shown in that example.
>
>
> On Wed, Nov 20, 2013 at 5:29 PM, flovansi &lt; [hidden email] &gt; wrote:
>
> &gt; Hi all,
> &gt;
> &gt; Is it possible to consume message from a Java bean?
> &gt;
> &gt; Something like:
> &gt;
> &gt; &lt;from ref=&quot;myBean&quot;/&gt;
> &gt;
> &gt; where myBean could be a custom bean to get JMS message from a queue, or
> &gt; anything you can think of.
> &gt;
> &gt; I know that I can achieve that by creating custom Camel Component but a 
> Java
> &gt; Bean could be simpler in my case.
> &gt;
> &gt; If it's not possible, is there any other way to achieve that?
> &gt;
> &gt; Thank you,
> &gt;
> &gt; Florent
> &gt;
> &gt;
> &gt;
> &gt; --
> &gt; View this message in context:
> http://camel.465427.n5.nabble.com/Consume-from-a-java-bean-tp5743580.html
> &gt; Sent from the Camel Development mailing list archive at
> Nabble.com .
>
>
>
> --
> Claus Ibsen
> -----------------
> Red Hat, Inc.
> Email:
> [hidden email]
> Twitter: davsclaus
> Blog:
> http://davsclaus.com
> Author of Camel in Action:
> http://www.manning.com/ibsen
>
>
>
>
> If you reply to this email, your message will be added to the discussion 
> below:
> http://camel.465427.n5.nabble.com/Consume-from-a-java-bean-tp5743580p5743581.html
>
>
> To unsubscribe from Consume from a java bean,
> click here .
> NAML
>
>
>
>
>
>
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Consume-from-a-java-bean-tp5743580p5743587.html
> Sent from the Camel Development mailing list archive at Nabble.com.



--
Claus Ibsen
-----------------
Red Hat, Inc.
Email: [hidden email]</user/SendEmail.jtp?type=node&node=5743588&i=2>
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

________________________________
If you reply to this email, your message will be added to the discussion below:
http://camel.465427.n5.nabble.com/Consume-from-a-java-bean-tp5743580p5743588.html
To unsubscribe from Consume from a java bean, click 
here<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5743580&code=ZmxvcmVudC52YW5zaWxpZXR0ZUBzd2lmdC5jb218NTc0MzU4MHwtMjA1MTYxNjE4MA==>.
NAML<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>




--
View this message in context: 
http://camel.465427.n5.nabble.com/Consume-from-a-java-bean-tp5743580p5743602.html
Sent from the Camel Development mailing list archive at Nabble.com.

Reply via email to