2008/4/14, runr <[EMAIL PROTECTED]>:
> I have a use case where a JMS client sends an ObjectMessage to a WebLogic
> JMS queue. Using Camel, I retrieve the message off the queue and route it
> to a JmsToEjbMethod Processor implementation. The Processor obtains the
> parameters needed to invoke an EJB method from the JMS message, populates an
> Object array and instantiates a BeanInvocation that specifies the
> appropriate EJB method and contains the Object array of the method's
> parameters.
>
> The EJB method is then invoked and returns fine.
>
> Then I need to re-transform the response for the JMSReplyTo temporary queue
> that the original JMS client is listening on. I am able to accomplish this
> with another Processor implementation - EjbMethodToJms.
>
> In order to send the JMS response message back to the JMSReplyTo queue, I
> had to re-obtain a QueueConnectionFactory, get a QueueConnection, and create
> a QueueSession in order to send the response message back. I could not
> figure out a way to get access to the original JMS request's QueueSession in
> the first JmsToEjbMethod Processor to save in a Header for using when the
> second EjbMethodToJms Processor wants to send the awaited response.
>
> Is there a means by which I can maintain the session to the JMS queue across
> the EJB method call to send the expected response?
>
> Does this sound like a reasonable approach for accomplishing this
> integration, or is there a better way?
It looks that what you want to do can be done automatically.
When you specify from("jms:inQueue") and if the message received
contains JMSReplyTo (that is the case) then your exchange is InOut. It
means, that any outcome from your flow will be automatically replied
to JMSReplyTo queue.
So I believe it should be enough to do something like this (if I
correctly understand what JmsToEjbMethod class does):
from("jms:inQueue").process(new JmsToEjbMethod()).to("bean:ejbProxy");
then, the response from your EJB invocation is simply returned back to
jms:inQueue endpoint that uses original JMSReplyTo queue/topic to send
the response.
I hope it helps,
Roman