camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: Bootstrapping camel from MDB
Date Wed, 16 Sep 2009 06:12:53 GMT
On Wed, Sep 16, 2009 at 8:07 AM, marcuse <krummas@gmail.com> wrote:
>
> Yes it is a real EJB MDB
>
> So I just set up my camel context & ProducerTemplate in the MDB constructor
> and then in the onMessage method i do
> producerTemplate.sendBody("whatever",theJmsMessage); ?

Yeah pretty much. As you are not using the camel-jms to receive the
JMS message it have not done its bidning from JMS world to Java world
which means that extraating JMS body, and JMS properties cannot be
done automatic by Camel. Which may require you to do that manually if
you need them.

// for example to extract the jms as a text message
String text = ((TextMessage) message).getText();
producerTemplate.sendBody("whatever", text);

However Camel also have its type converter mechanism which may support
this out of the box. I gotta check the source to be sure. As you are
the first with that must use MDB.


>
> /Marcus
>
>
>
> Claus Ibsen-2 wrote:
>>
>> On Tue, Sep 15, 2009 at 2:49 PM, marcuse <krummas@gmail.com> wrote:
>>>
>>> Hi
>>>
>>> I have a project which uses MDBs, and I want to try using camel for
>>> routing
>>> incoming messages to various message handlers, googling showed me
>>> http://camel.apache.org/maven/camel-jms/apidocs/org/apache/camel/component/jms/CamelMessageListener.html
>>> but this seems removed from camel 2.0.
>>>
>>> Also looked at the source for CamelMessageListener to reproduce the
>>> functionality, but I did not get by the fact that JmsExchange was removed
>>>
>>> So, my question is, what is the best practise for using camel from an
>>> MDB?
>>>
>>
>> You are using real EJB MDB, if I understand you correctly?
>>
>> And then you want in the onMessage(Message msg) method to route the
>> message with Camel?
>>
>> You can take a look at this example:
>> http://camel.apache.org/walk-through-an-example.html
>>
>> Where you can setup Camel manually in the MDB and then use it to route
>> the message.
>>
>>
>> Camel itself can of course also listen to JMS queues, in case you not
>> need to use MDB.
>>
>>
>>> /Marcus
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Bootstrapping-camel-from-MDB-tp25453382p25453382.html
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>
>>>
>>
>>
>>
>> --
>> Claus Ibsen
>> Apache Camel Committer
>>
>> Open Source Integration: http://fusesource.com
>> Blog: http://davsclaus.blogspot.com/
>> Twitter: http://twitter.com/davsclaus
>>
>>
>
> --
> View this message in context: http://www.nabble.com/Bootstrapping-camel-from-MDB-tp25453382p25466487.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Mime
View raw message