You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Burkard Stephan <st...@visana.ch> on 2012/03/21 10:54:59 UTC

Transacted CXF-Consumer from queue

Hello
 
I try to get running a SOAP over JMS usecase with the configuration
outlined here:
http://camel.apache.org/better-jms-transport-for-cxf-webservice-using-ap
ache-camel.html
<http://camel.apache.org/better-jms-transport-for-cxf-webservice-using-a
pache-camel.html> 
 
My webservice is InOnly, it does not respond to requests. The client
therefore sends SOAP messages to a queue without waiting for an answer.
On the server side camel consumes the messages. 
 
I tried to test transaction behaviour of my camel routes with unittests
where I advice the route with exceptions that occur at specific
entpoints. This works fine when I consume from the queue directly
(activemq:queue:...). If an error occurs the message is not commited and
it stays in the queue. 
When I use a CXF endpoint to consume messages (cxf:bean:...), messages
are lost when an exception occurs. They seem to be commited in activemq
before or despite an error occurs. 
Therefore I tried to read first from the queue directly, forward the
message to a direct endpoint and consume the messages with CXF from the
direct endpoint. But in this case the message is also lost if an error
occurs after consuming the message with CXF. 
 
Before posting routes and configuration details, I just would like to
know if this is "normal" behaviour of the CXF endpoint with inOnly MEP
or if the messages should stay in the queue as I expect?
 
Perhaps this is the same problem as described in this thread:
http://camel.465427.n5.nabble.com/CXF-Camel-JMS-Endpoint-exception-handl
ing-td4471175.html
<http://camel.465427.n5.nabble.com/CXF-Camel-JMS-Endpoint-exception-hand
ling-td4471175.html> ?
 
Thanks for your help
Stefan

Re: Transacted CXF-Consumer from queue

Posted by Stefan Burkard <sb...@gmail.com>.
Hi

Finally I had the time to build a tiny project with testcases (based
on camel-in-action examples) that illustrates the problem as code. You
can find it as attachment.

As you can see in the tests, Christians advice to mark the route
"manually" as in-out does not help (or I am doing it wrong). The CXF
endpoint commits messages to the queue even when exceptions in the
route occur. Therefore the messages are lost. If my test is correct,
the Issue CAMEL-5119 would probably be obsolete.

Can somebody give me a hint how to avoid this? I would like to consume
SOAP messages from a queue that were put asynchronously into the
queue. Therefore I have given webservices marked as @Oneway as in my
example.

Thanks for any help
Stefan


On Fri, Mar 23, 2012 at 11:04, Stefan Burkard <sb...@gmail.com> wrote:
> can I mark the route like this as InOut?
> from("cxf:bean:mycxfbean").inOut()...
>
>
> ...and yes, I will create a JIRA issue for that
>
> Stefan
>
>
> On Fri, Mar 23, 2012 at 10:48, Stefan Burkard <sb...@gmail.com> wrote:
>> Hi Christian
>>
>> How would I do that? (sorry, Camel beginner :-)
>>
>> Stefan
>>
>>
>> On Fri, Mar 23, 2012 at 10:18, Christian Schneider
>> <ch...@die-schneider.net> wrote:
>>> Perhaps you can mark the route as inout. So the cxf from endpoint could get
>>> the response but of course does not have to reply.
>>>
>>> I think for transacted routes we should make this the default. Can you open
>>> a jira issue for that?
>>>
>>> Christian
>>>
>>> Am 23.03.2012 09:49, schrieb Stefan Burkard:
>>>
>>>> My problem seems to be that, with MEP InOnly, a CXF endpoint consuming
>>>> from a queue does not "see" an exception that occurs later in the
>>>> route and therefore commits the consumptions to the queue.
>>>>
>>>> Does anybody know how I can make this exception visible to CXF? I
>>>> think this should be possible, otherwise it would not be possible to
>>>> read asynchronous and transacted with CXF from a queue.
>>>>
>>>> Thanks
>>>> Stefan
>>>>
>>>>
>>>> On Wed, Mar 21, 2012 at 17:26, Stefan Burkard<sb...@gmail.com>  wrote:
>>>>>
>>>>> Hi Willem
>>>>>
>>>>> I suspected something like this - I am a Camel beginner and therefore
>>>>> didn't know if this is a bug or a feature :-)
>>>>>
>>>>> My case is to make the following routes transactional:
>>>>> 1. I am consuming messages with a CXF bean endpoint from an ActiveMQ
>>>>> queue to get an unmarshalled Exchange (the producer sends - fire and
>>>>> forget - SOAP messages with mtom attachments to the queue)
>>>>> 2. I am sending the Exchanges with ".to(direct:...)" to the main route
>>>>> of my module
>>>>> 3. The main route processes the Exchanges
>>>>>
>>>>> To check how these routes behave under error conditions, I am
>>>>> injecting intentionally an exception into the direct-endpoint
>>>>> (to"direct:...") of the first route. Therefore I am getting (as
>>>>> expected) the exception and afterwards the queue is empty. This means
>>>>> my route is not secured against message loss. If I understand you
>>>>> correctly, the exception that occurs during route-processing is not
>>>>> recoginsed by the CXF-consumer and therefore the consumer commits the
>>>>> message consumption to the queue.
>>>>>
>>>>> So, how can I make this asynchronous SOAP over JMS usecase
>>>>> transactional so that the message remains in the queue if an error
>>>>> occurs during route processing?
>>>>>
>>>>> Thanks for your help
>>>>> Stefan
>>>>>
>>>>>
>>>>> On Wed, Mar 21, 2012 at 14:23, Willem Jiang<wi...@gmail.com>
>>>>>  wrote:
>>>>>>
>>>>>> If you are using inOnly MEP, camel-cxf producer will not know any thing
>>>>>> about the exception.
>>>>>> I'm not sure what kind of error that you get.
>>>>>>
>>>>>>
>>>>>>
>>>>>> On 3/21/12 5:54 PM, Burkard Stephan wrote:
>>>>>>>
>>>>>>> Hello
>>>>>>>
>>>>>>> I try to get running a SOAP over JMS usecase with the configuration
>>>>>>> outlined here:
>>>>>>>
>>>>>>> http://camel.apache.org/better-jms-transport-for-cxf-webservice-using-ap
>>>>>>> ache-camel.html
>>>>>>>
>>>>>>> <http://camel.apache.org/better-jms-transport-for-cxf-webservice-using-a
>>>>>>> pache-camel.html>
>>>>>>>
>>>>>>> My webservice is InOnly, it does not respond to requests. The client
>>>>>>> therefore sends SOAP messages to a queue without waiting for an answer.
>>>>>>> On the server side camel consumes the messages.
>>>>>>>
>>>>>>> I tried to test transaction behaviour of my camel routes with unittests
>>>>>>> where I advice the route with exceptions that occur at specific
>>>>>>> entpoints. This works fine when I consume from the queue directly
>>>>>>> (activemq:queue:...). If an error occurs the message is not commited
>>>>>>> and
>>>>>>> it stays in the queue.
>>>>>>> When I use a CXF endpoint to consume messages (cxf:bean:...), messages
>>>>>>> are lost when an exception occurs. They seem to be commited in activemq
>>>>>>> before or despite an error occurs.
>>>>>>> Therefore I tried to read first from the queue directly, forward the
>>>>>>> message to a direct endpoint and consume the messages with CXF from the
>>>>>>> direct endpoint. But in this case the message is also lost if an error
>>>>>>> occurs after consuming the message with CXF.
>>>>>>>
>>>>>>> Before posting routes and configuration details, I just would like to
>>>>>>> know if this is "normal" behaviour of the CXF endpoint with inOnly MEP
>>>>>>> or if the messages should stay in the queue as I expect?
>>>>>>>
>>>>>>> Perhaps this is the same problem as described in this thread:
>>>>>>>
>>>>>>> http://camel.465427.n5.nabble.com/CXF-Camel-JMS-Endpoint-exception-handl
>>>>>>> ing-td4471175.html
>>>>>>>
>>>>>>> <http://camel.465427.n5.nabble.com/CXF-Camel-JMS-Endpoint-exception-hand
>>>>>>> ling-td4471175.html>    ?
>>>>>>>
>>>>>>> Thanks for your help
>>>>>>> Stefan
>>>>>>>
>>>>>>
>>>>>> --
>>>>>> Willem
>>>>>> ----------------------------------
>>>>>> FuseSource
>>>>>> Web: http://www.fusesource.com
>>>>>> Blog:    http://willemjiang.blogspot.com (English)
>>>>>>         http://jnn.javaeye.com (Chinese)
>>>>>> Twitter: willemjiang
>>>>>> Weibo: willemjiang
>>>
>>>
>>>
>>> --
>>> Christian Schneider
>>> http://www.liquid-reality.de
>>>
>>> Open Source Architect
>>> Talend Application Integration Division http://www.talend.com
>>>

Re: Transacted CXF-Consumer from queue

Posted by Stefan Burkard <sb...@gmail.com>.
can I mark the route like this as InOut?
from("cxf:bean:mycxfbean").inOut()...


...and yes, I will create a JIRA issue for that

Stefan


On Fri, Mar 23, 2012 at 10:48, Stefan Burkard <sb...@gmail.com> wrote:
> Hi Christian
>
> How would I do that? (sorry, Camel beginner :-)
>
> Stefan
>
>
> On Fri, Mar 23, 2012 at 10:18, Christian Schneider
> <ch...@die-schneider.net> wrote:
>> Perhaps you can mark the route as inout. So the cxf from endpoint could get
>> the response but of course does not have to reply.
>>
>> I think for transacted routes we should make this the default. Can you open
>> a jira issue for that?
>>
>> Christian
>>
>> Am 23.03.2012 09:49, schrieb Stefan Burkard:
>>
>>> My problem seems to be that, with MEP InOnly, a CXF endpoint consuming
>>> from a queue does not "see" an exception that occurs later in the
>>> route and therefore commits the consumptions to the queue.
>>>
>>> Does anybody know how I can make this exception visible to CXF? I
>>> think this should be possible, otherwise it would not be possible to
>>> read asynchronous and transacted with CXF from a queue.
>>>
>>> Thanks
>>> Stefan
>>>
>>>
>>> On Wed, Mar 21, 2012 at 17:26, Stefan Burkard<sb...@gmail.com>  wrote:
>>>>
>>>> Hi Willem
>>>>
>>>> I suspected something like this - I am a Camel beginner and therefore
>>>> didn't know if this is a bug or a feature :-)
>>>>
>>>> My case is to make the following routes transactional:
>>>> 1. I am consuming messages with a CXF bean endpoint from an ActiveMQ
>>>> queue to get an unmarshalled Exchange (the producer sends - fire and
>>>> forget - SOAP messages with mtom attachments to the queue)
>>>> 2. I am sending the Exchanges with ".to(direct:...)" to the main route
>>>> of my module
>>>> 3. The main route processes the Exchanges
>>>>
>>>> To check how these routes behave under error conditions, I am
>>>> injecting intentionally an exception into the direct-endpoint
>>>> (to"direct:...") of the first route. Therefore I am getting (as
>>>> expected) the exception and afterwards the queue is empty. This means
>>>> my route is not secured against message loss. If I understand you
>>>> correctly, the exception that occurs during route-processing is not
>>>> recoginsed by the CXF-consumer and therefore the consumer commits the
>>>> message consumption to the queue.
>>>>
>>>> So, how can I make this asynchronous SOAP over JMS usecase
>>>> transactional so that the message remains in the queue if an error
>>>> occurs during route processing?
>>>>
>>>> Thanks for your help
>>>> Stefan
>>>>
>>>>
>>>> On Wed, Mar 21, 2012 at 14:23, Willem Jiang<wi...@gmail.com>
>>>>  wrote:
>>>>>
>>>>> If you are using inOnly MEP, camel-cxf producer will not know any thing
>>>>> about the exception.
>>>>> I'm not sure what kind of error that you get.
>>>>>
>>>>>
>>>>>
>>>>> On 3/21/12 5:54 PM, Burkard Stephan wrote:
>>>>>>
>>>>>> Hello
>>>>>>
>>>>>> I try to get running a SOAP over JMS usecase with the configuration
>>>>>> outlined here:
>>>>>>
>>>>>> http://camel.apache.org/better-jms-transport-for-cxf-webservice-using-ap
>>>>>> ache-camel.html
>>>>>>
>>>>>> <http://camel.apache.org/better-jms-transport-for-cxf-webservice-using-a
>>>>>> pache-camel.html>
>>>>>>
>>>>>> My webservice is InOnly, it does not respond to requests. The client
>>>>>> therefore sends SOAP messages to a queue without waiting for an answer.
>>>>>> On the server side camel consumes the messages.
>>>>>>
>>>>>> I tried to test transaction behaviour of my camel routes with unittests
>>>>>> where I advice the route with exceptions that occur at specific
>>>>>> entpoints. This works fine when I consume from the queue directly
>>>>>> (activemq:queue:...). If an error occurs the message is not commited
>>>>>> and
>>>>>> it stays in the queue.
>>>>>> When I use a CXF endpoint to consume messages (cxf:bean:...), messages
>>>>>> are lost when an exception occurs. They seem to be commited in activemq
>>>>>> before or despite an error occurs.
>>>>>> Therefore I tried to read first from the queue directly, forward the
>>>>>> message to a direct endpoint and consume the messages with CXF from the
>>>>>> direct endpoint. But in this case the message is also lost if an error
>>>>>> occurs after consuming the message with CXF.
>>>>>>
>>>>>> Before posting routes and configuration details, I just would like to
>>>>>> know if this is "normal" behaviour of the CXF endpoint with inOnly MEP
>>>>>> or if the messages should stay in the queue as I expect?
>>>>>>
>>>>>> Perhaps this is the same problem as described in this thread:
>>>>>>
>>>>>> http://camel.465427.n5.nabble.com/CXF-Camel-JMS-Endpoint-exception-handl
>>>>>> ing-td4471175.html
>>>>>>
>>>>>> <http://camel.465427.n5.nabble.com/CXF-Camel-JMS-Endpoint-exception-hand
>>>>>> ling-td4471175.html>    ?
>>>>>>
>>>>>> Thanks for your help
>>>>>> Stefan
>>>>>>
>>>>>
>>>>> --
>>>>> Willem
>>>>> ----------------------------------
>>>>> FuseSource
>>>>> Web: http://www.fusesource.com
>>>>> Blog:    http://willemjiang.blogspot.com (English)
>>>>>         http://jnn.javaeye.com (Chinese)
>>>>> Twitter: willemjiang
>>>>> Weibo: willemjiang
>>
>>
>>
>> --
>> Christian Schneider
>> http://www.liquid-reality.de
>>
>> Open Source Architect
>> Talend Application Integration Division http://www.talend.com
>>

Re: Transacted CXF-Consumer from queue

Posted by Stefan Burkard <sb...@gmail.com>.
Hi Christian

How would I do that? (sorry, Camel beginner :-)

Stefan


On Fri, Mar 23, 2012 at 10:18, Christian Schneider
<ch...@die-schneider.net> wrote:
> Perhaps you can mark the route as inout. So the cxf from endpoint could get
> the response but of course does not have to reply.
>
> I think for transacted routes we should make this the default. Can you open
> a jira issue for that?
>
> Christian
>
> Am 23.03.2012 09:49, schrieb Stefan Burkard:
>
>> My problem seems to be that, with MEP InOnly, a CXF endpoint consuming
>> from a queue does not "see" an exception that occurs later in the
>> route and therefore commits the consumptions to the queue.
>>
>> Does anybody know how I can make this exception visible to CXF? I
>> think this should be possible, otherwise it would not be possible to
>> read asynchronous and transacted with CXF from a queue.
>>
>> Thanks
>> Stefan
>>
>>
>> On Wed, Mar 21, 2012 at 17:26, Stefan Burkard<sb...@gmail.com>  wrote:
>>>
>>> Hi Willem
>>>
>>> I suspected something like this - I am a Camel beginner and therefore
>>> didn't know if this is a bug or a feature :-)
>>>
>>> My case is to make the following routes transactional:
>>> 1. I am consuming messages with a CXF bean endpoint from an ActiveMQ
>>> queue to get an unmarshalled Exchange (the producer sends - fire and
>>> forget - SOAP messages with mtom attachments to the queue)
>>> 2. I am sending the Exchanges with ".to(direct:...)" to the main route
>>> of my module
>>> 3. The main route processes the Exchanges
>>>
>>> To check how these routes behave under error conditions, I am
>>> injecting intentionally an exception into the direct-endpoint
>>> (to"direct:...") of the first route. Therefore I am getting (as
>>> expected) the exception and afterwards the queue is empty. This means
>>> my route is not secured against message loss. If I understand you
>>> correctly, the exception that occurs during route-processing is not
>>> recoginsed by the CXF-consumer and therefore the consumer commits the
>>> message consumption to the queue.
>>>
>>> So, how can I make this asynchronous SOAP over JMS usecase
>>> transactional so that the message remains in the queue if an error
>>> occurs during route processing?
>>>
>>> Thanks for your help
>>> Stefan
>>>
>>>
>>> On Wed, Mar 21, 2012 at 14:23, Willem Jiang<wi...@gmail.com>
>>>  wrote:
>>>>
>>>> If you are using inOnly MEP, camel-cxf producer will not know any thing
>>>> about the exception.
>>>> I'm not sure what kind of error that you get.
>>>>
>>>>
>>>>
>>>> On 3/21/12 5:54 PM, Burkard Stephan wrote:
>>>>>
>>>>> Hello
>>>>>
>>>>> I try to get running a SOAP over JMS usecase with the configuration
>>>>> outlined here:
>>>>>
>>>>> http://camel.apache.org/better-jms-transport-for-cxf-webservice-using-ap
>>>>> ache-camel.html
>>>>>
>>>>> <http://camel.apache.org/better-jms-transport-for-cxf-webservice-using-a
>>>>> pache-camel.html>
>>>>>
>>>>> My webservice is InOnly, it does not respond to requests. The client
>>>>> therefore sends SOAP messages to a queue without waiting for an answer.
>>>>> On the server side camel consumes the messages.
>>>>>
>>>>> I tried to test transaction behaviour of my camel routes with unittests
>>>>> where I advice the route with exceptions that occur at specific
>>>>> entpoints. This works fine when I consume from the queue directly
>>>>> (activemq:queue:...). If an error occurs the message is not commited
>>>>> and
>>>>> it stays in the queue.
>>>>> When I use a CXF endpoint to consume messages (cxf:bean:...), messages
>>>>> are lost when an exception occurs. They seem to be commited in activemq
>>>>> before or despite an error occurs.
>>>>> Therefore I tried to read first from the queue directly, forward the
>>>>> message to a direct endpoint and consume the messages with CXF from the
>>>>> direct endpoint. But in this case the message is also lost if an error
>>>>> occurs after consuming the message with CXF.
>>>>>
>>>>> Before posting routes and configuration details, I just would like to
>>>>> know if this is "normal" behaviour of the CXF endpoint with inOnly MEP
>>>>> or if the messages should stay in the queue as I expect?
>>>>>
>>>>> Perhaps this is the same problem as described in this thread:
>>>>>
>>>>> http://camel.465427.n5.nabble.com/CXF-Camel-JMS-Endpoint-exception-handl
>>>>> ing-td4471175.html
>>>>>
>>>>> <http://camel.465427.n5.nabble.com/CXF-Camel-JMS-Endpoint-exception-hand
>>>>> ling-td4471175.html>    ?
>>>>>
>>>>> Thanks for your help
>>>>> Stefan
>>>>>
>>>>
>>>> --
>>>> Willem
>>>> ----------------------------------
>>>> FuseSource
>>>> Web: http://www.fusesource.com
>>>> Blog:    http://willemjiang.blogspot.com (English)
>>>>         http://jnn.javaeye.com (Chinese)
>>>> Twitter: willemjiang
>>>> Weibo: willemjiang
>
>
>
> --
> Christian Schneider
> http://www.liquid-reality.de
>
> Open Source Architect
> Talend Application Integration Division http://www.talend.com
>

Re: Transacted CXF-Consumer from queue

Posted by Christian Schneider <ch...@die-schneider.net>.
Perhaps you can mark the route as inout. So the cxf from endpoint could 
get the response but of course does not have to reply.

I think for transacted routes we should make this the default. Can you 
open a jira issue for that?

Christian

Am 23.03.2012 09:49, schrieb Stefan Burkard:
> My problem seems to be that, with MEP InOnly, a CXF endpoint consuming
> from a queue does not "see" an exception that occurs later in the
> route and therefore commits the consumptions to the queue.
>
> Does anybody know how I can make this exception visible to CXF? I
> think this should be possible, otherwise it would not be possible to
> read asynchronous and transacted with CXF from a queue.
>
> Thanks
> Stefan
>
>
> On Wed, Mar 21, 2012 at 17:26, Stefan Burkard<sb...@gmail.com>  wrote:
>> Hi Willem
>>
>> I suspected something like this - I am a Camel beginner and therefore
>> didn't know if this is a bug or a feature :-)
>>
>> My case is to make the following routes transactional:
>> 1. I am consuming messages with a CXF bean endpoint from an ActiveMQ
>> queue to get an unmarshalled Exchange (the producer sends - fire and
>> forget - SOAP messages with mtom attachments to the queue)
>> 2. I am sending the Exchanges with ".to(direct:...)" to the main route
>> of my module
>> 3. The main route processes the Exchanges
>>
>> To check how these routes behave under error conditions, I am
>> injecting intentionally an exception into the direct-endpoint
>> (to"direct:...") of the first route. Therefore I am getting (as
>> expected) the exception and afterwards the queue is empty. This means
>> my route is not secured against message loss. If I understand you
>> correctly, the exception that occurs during route-processing is not
>> recoginsed by the CXF-consumer and therefore the consumer commits the
>> message consumption to the queue.
>>
>> So, how can I make this asynchronous SOAP over JMS usecase
>> transactional so that the message remains in the queue if an error
>> occurs during route processing?
>>
>> Thanks for your help
>> Stefan
>>
>>
>> On Wed, Mar 21, 2012 at 14:23, Willem Jiang<wi...@gmail.com>  wrote:
>>> If you are using inOnly MEP, camel-cxf producer will not know any thing
>>> about the exception.
>>> I'm not sure what kind of error that you get.
>>>
>>>
>>>
>>> On 3/21/12 5:54 PM, Burkard Stephan wrote:
>>>> Hello
>>>>
>>>> I try to get running a SOAP over JMS usecase with the configuration
>>>> outlined here:
>>>> http://camel.apache.org/better-jms-transport-for-cxf-webservice-using-ap
>>>> ache-camel.html
>>>> <http://camel.apache.org/better-jms-transport-for-cxf-webservice-using-a
>>>> pache-camel.html>
>>>>
>>>> My webservice is InOnly, it does not respond to requests. The client
>>>> therefore sends SOAP messages to a queue without waiting for an answer.
>>>> On the server side camel consumes the messages.
>>>>
>>>> I tried to test transaction behaviour of my camel routes with unittests
>>>> where I advice the route with exceptions that occur at specific
>>>> entpoints. This works fine when I consume from the queue directly
>>>> (activemq:queue:...). If an error occurs the message is not commited and
>>>> it stays in the queue.
>>>> When I use a CXF endpoint to consume messages (cxf:bean:...), messages
>>>> are lost when an exception occurs. They seem to be commited in activemq
>>>> before or despite an error occurs.
>>>> Therefore I tried to read first from the queue directly, forward the
>>>> message to a direct endpoint and consume the messages with CXF from the
>>>> direct endpoint. But in this case the message is also lost if an error
>>>> occurs after consuming the message with CXF.
>>>>
>>>> Before posting routes and configuration details, I just would like to
>>>> know if this is "normal" behaviour of the CXF endpoint with inOnly MEP
>>>> or if the messages should stay in the queue as I expect?
>>>>
>>>> Perhaps this is the same problem as described in this thread:
>>>> http://camel.465427.n5.nabble.com/CXF-Camel-JMS-Endpoint-exception-handl
>>>> ing-td4471175.html
>>>> <http://camel.465427.n5.nabble.com/CXF-Camel-JMS-Endpoint-exception-hand
>>>> ling-td4471175.html>    ?
>>>>
>>>> Thanks for your help
>>>> Stefan
>>>>
>>>
>>> --
>>> Willem
>>> ----------------------------------
>>> FuseSource
>>> Web: http://www.fusesource.com
>>> Blog:    http://willemjiang.blogspot.com (English)
>>>          http://jnn.javaeye.com (Chinese)
>>> Twitter: willemjiang
>>> Weibo: willemjiang


-- 
Christian Schneider
http://www.liquid-reality.de

Open Source Architect
Talend Application Integration Division http://www.talend.com


Re: Transacted CXF-Consumer from queue

Posted by Stefan Burkard <sb...@gmail.com>.
My problem seems to be that, with MEP InOnly, a CXF endpoint consuming
from a queue does not "see" an exception that occurs later in the
route and therefore commits the consumptions to the queue.

Does anybody know how I can make this exception visible to CXF? I
think this should be possible, otherwise it would not be possible to
read asynchronous and transacted with CXF from a queue.

Thanks
Stefan


On Wed, Mar 21, 2012 at 17:26, Stefan Burkard <sb...@gmail.com> wrote:
> Hi Willem
>
> I suspected something like this - I am a Camel beginner and therefore
> didn't know if this is a bug or a feature :-)
>
> My case is to make the following routes transactional:
> 1. I am consuming messages with a CXF bean endpoint from an ActiveMQ
> queue to get an unmarshalled Exchange (the producer sends - fire and
> forget - SOAP messages with mtom attachments to the queue)
> 2. I am sending the Exchanges with ".to(direct:...)" to the main route
> of my module
> 3. The main route processes the Exchanges
>
> To check how these routes behave under error conditions, I am
> injecting intentionally an exception into the direct-endpoint
> (to"direct:...") of the first route. Therefore I am getting (as
> expected) the exception and afterwards the queue is empty. This means
> my route is not secured against message loss. If I understand you
> correctly, the exception that occurs during route-processing is not
> recoginsed by the CXF-consumer and therefore the consumer commits the
> message consumption to the queue.
>
> So, how can I make this asynchronous SOAP over JMS usecase
> transactional so that the message remains in the queue if an error
> occurs during route processing?
>
> Thanks for your help
> Stefan
>
>
> On Wed, Mar 21, 2012 at 14:23, Willem Jiang <wi...@gmail.com> wrote:
>> If you are using inOnly MEP, camel-cxf producer will not know any thing
>> about the exception.
>> I'm not sure what kind of error that you get.
>>
>>
>>
>> On 3/21/12 5:54 PM, Burkard Stephan wrote:
>>>
>>> Hello
>>>
>>> I try to get running a SOAP over JMS usecase with the configuration
>>> outlined here:
>>> http://camel.apache.org/better-jms-transport-for-cxf-webservice-using-ap
>>> ache-camel.html
>>> <http://camel.apache.org/better-jms-transport-for-cxf-webservice-using-a
>>> pache-camel.html>
>>>
>>> My webservice is InOnly, it does not respond to requests. The client
>>> therefore sends SOAP messages to a queue without waiting for an answer.
>>> On the server side camel consumes the messages.
>>>
>>> I tried to test transaction behaviour of my camel routes with unittests
>>> where I advice the route with exceptions that occur at specific
>>> entpoints. This works fine when I consume from the queue directly
>>> (activemq:queue:...). If an error occurs the message is not commited and
>>> it stays in the queue.
>>> When I use a CXF endpoint to consume messages (cxf:bean:...), messages
>>> are lost when an exception occurs. They seem to be commited in activemq
>>> before or despite an error occurs.
>>> Therefore I tried to read first from the queue directly, forward the
>>> message to a direct endpoint and consume the messages with CXF from the
>>> direct endpoint. But in this case the message is also lost if an error
>>> occurs after consuming the message with CXF.
>>>
>>> Before posting routes and configuration details, I just would like to
>>> know if this is "normal" behaviour of the CXF endpoint with inOnly MEP
>>> or if the messages should stay in the queue as I expect?
>>>
>>> Perhaps this is the same problem as described in this thread:
>>> http://camel.465427.n5.nabble.com/CXF-Camel-JMS-Endpoint-exception-handl
>>> ing-td4471175.html
>>> <http://camel.465427.n5.nabble.com/CXF-Camel-JMS-Endpoint-exception-hand
>>> ling-td4471175.html>  ?
>>>
>>> Thanks for your help
>>> Stefan
>>>
>>
>>
>> --
>> Willem
>> ----------------------------------
>> FuseSource
>> Web: http://www.fusesource.com
>> Blog:    http://willemjiang.blogspot.com (English)
>>         http://jnn.javaeye.com (Chinese)
>> Twitter: willemjiang
>> Weibo: willemjiang

Re: Transacted CXF-Consumer from queue

Posted by Stefan Burkard <sb...@gmail.com>.
Hi Willem

I suspected something like this - I am a Camel beginner and therefore
didn't know if this is a bug or a feature :-)

My case is to make the following routes transactional:
1. I am consuming messages with a CXF bean endpoint from an ActiveMQ
queue to get an unmarshalled Exchange (the producer sends - fire and
forget - SOAP messages with mtom attachments to the queue)
2. I am sending the Exchanges with ".to(direct:...)" to the main route
of my module
3. The main route processes the Exchanges

To check how these routes behave under error conditions, I am
injecting intentionally an exception into the direct-endpoint
(to"direct:...") of the first route. Therefore I am getting (as
expected) the exception and afterwards the queue is empty. This means
my route is not secured against message loss. If I understand you
correctly, the exception that occurs during route-processing is not
recoginsed by the CXF-consumer and therefore the consumer commits the
message consumption to the queue.

So, how can I make this asynchronous SOAP over JMS usecase
transactional so that the message remains in the queue if an error
occurs during route processing?

Thanks for your help
Stefan


On Wed, Mar 21, 2012 at 14:23, Willem Jiang <wi...@gmail.com> wrote:
> If you are using inOnly MEP, camel-cxf producer will not know any thing
> about the exception.
> I'm not sure what kind of error that you get.
>
>
>
> On 3/21/12 5:54 PM, Burkard Stephan wrote:
>>
>> Hello
>>
>> I try to get running a SOAP over JMS usecase with the configuration
>> outlined here:
>> http://camel.apache.org/better-jms-transport-for-cxf-webservice-using-ap
>> ache-camel.html
>> <http://camel.apache.org/better-jms-transport-for-cxf-webservice-using-a
>> pache-camel.html>
>>
>> My webservice is InOnly, it does not respond to requests. The client
>> therefore sends SOAP messages to a queue without waiting for an answer.
>> On the server side camel consumes the messages.
>>
>> I tried to test transaction behaviour of my camel routes with unittests
>> where I advice the route with exceptions that occur at specific
>> entpoints. This works fine when I consume from the queue directly
>> (activemq:queue:...). If an error occurs the message is not commited and
>> it stays in the queue.
>> When I use a CXF endpoint to consume messages (cxf:bean:...), messages
>> are lost when an exception occurs. They seem to be commited in activemq
>> before or despite an error occurs.
>> Therefore I tried to read first from the queue directly, forward the
>> message to a direct endpoint and consume the messages with CXF from the
>> direct endpoint. But in this case the message is also lost if an error
>> occurs after consuming the message with CXF.
>>
>> Before posting routes and configuration details, I just would like to
>> know if this is "normal" behaviour of the CXF endpoint with inOnly MEP
>> or if the messages should stay in the queue as I expect?
>>
>> Perhaps this is the same problem as described in this thread:
>> http://camel.465427.n5.nabble.com/CXF-Camel-JMS-Endpoint-exception-handl
>> ing-td4471175.html
>> <http://camel.465427.n5.nabble.com/CXF-Camel-JMS-Endpoint-exception-hand
>> ling-td4471175.html>  ?
>>
>> Thanks for your help
>> Stefan
>>
>
>
> --
> Willem
> ----------------------------------
> FuseSource
> Web: http://www.fusesource.com
> Blog:    http://willemjiang.blogspot.com (English)
>         http://jnn.javaeye.com (Chinese)
> Twitter: willemjiang
> Weibo: willemjiang

Re: Transacted CXF-Consumer from queue

Posted by Willem Jiang <wi...@gmail.com>.
If you are using inOnly MEP, camel-cxf producer will not know any thing 
about the exception.
I'm not sure what kind of error that you get.


On 3/21/12 5:54 PM, Burkard Stephan wrote:
> Hello
>
> I try to get running a SOAP over JMS usecase with the configuration
> outlined here:
> http://camel.apache.org/better-jms-transport-for-cxf-webservice-using-ap
> ache-camel.html
> <http://camel.apache.org/better-jms-transport-for-cxf-webservice-using-a
> pache-camel.html>
>
> My webservice is InOnly, it does not respond to requests. The client
> therefore sends SOAP messages to a queue without waiting for an answer.
> On the server side camel consumes the messages.
>
> I tried to test transaction behaviour of my camel routes with unittests
> where I advice the route with exceptions that occur at specific
> entpoints. This works fine when I consume from the queue directly
> (activemq:queue:...). If an error occurs the message is not commited and
> it stays in the queue.
> When I use a CXF endpoint to consume messages (cxf:bean:...), messages
> are lost when an exception occurs. They seem to be commited in activemq
> before or despite an error occurs.
> Therefore I tried to read first from the queue directly, forward the
> message to a direct endpoint and consume the messages with CXF from the
> direct endpoint. But in this case the message is also lost if an error
> occurs after consuming the message with CXF.
>
> Before posting routes and configuration details, I just would like to
> know if this is "normal" behaviour of the CXF endpoint with inOnly MEP
> or if the messages should stay in the queue as I expect?
>
> Perhaps this is the same problem as described in this thread:
> http://camel.465427.n5.nabble.com/CXF-Camel-JMS-Endpoint-exception-handl
> ing-td4471175.html
> <http://camel.465427.n5.nabble.com/CXF-Camel-JMS-Endpoint-exception-hand
> ling-td4471175.html>  ?
>
> Thanks for your help
> Stefan
>


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

Re: Transacted CXF-Consumer from queue

Posted by Stefan Burkard <sb...@gmail.com>.
Hi Aki

I have configured a cxfEndpoint that consumes a JMS queue
(address="activemq:queue:...").

I'm currently bound to Camel 2.2, so the "synchronous" property does
not exist, but I have already set the
"org.apache.cxf.interceptor.OneWayProcessorInterceptor.USE_ORIGINAL_THREAD"
property. Probably this is the "old" equivalent to set synchronous?

To be more precise on the usecase:
JMS-Queue -> from: CXF-bean-consumer ... to: direct-endpoint [Here I
advice an exception] => from: direct-endpoint ... to: depends. The
result of this is a failed processing and an empty queue, so the
message is lost.

If I replace the CXF-consumer with an activemq:queue-consumer the
transactions works fine, if an exception occurs the message stays in
the queue. But of course I would need to unmarshal etc. the SOAP
request manually.

Regards
Stefan


On Wed, Mar 21, 2012 at 12:58, Aki Yoshida <el...@googlemail.com> wrote:
> Hi,
> Is this a jms -> cxf route scenario and you want to get an exception
> from the cxf endpoint? In that case,  you need to set the synchronous
> property at the camel-cxf endpoint.
>
> http://camel.apache.org/cxf.html#CXF-URIformat
>
> regards, aki
>
> 2012/3/21 Burkard Stephan <st...@visana.ch>:
>> Hello
>>
>> I try to get running a SOAP over JMS usecase with the configuration
>> outlined here:
>> http://camel.apache.org/better-jms-transport-for-cxf-webservice-using-ap
>> ache-camel.html
>> <http://camel.apache.org/better-jms-transport-for-cxf-webservice-using-a
>> pache-camel.html>
>>
>> My webservice is InOnly, it does not respond to requests. The client
>> therefore sends SOAP messages to a queue without waiting for an answer.
>> On the server side camel consumes the messages.
>>
>> I tried to test transaction behaviour of my camel routes with unittests
>> where I advice the route with exceptions that occur at specific
>> entpoints. This works fine when I consume from the queue directly
>> (activemq:queue:...). If an error occurs the message is not commited and
>> it stays in the queue.
>> When I use a CXF endpoint to consume messages (cxf:bean:...), messages
>> are lost when an exception occurs. They seem to be commited in activemq
>> before or despite an error occurs.
>> Therefore I tried to read first from the queue directly, forward the
>> message to a direct endpoint and consume the messages with CXF from the
>> direct endpoint. But in this case the message is also lost if an error
>> occurs after consuming the message with CXF.
>>
>> Before posting routes and configuration details, I just would like to
>> know if this is "normal" behaviour of the CXF endpoint with inOnly MEP
>> or if the messages should stay in the queue as I expect?
>>
>> Perhaps this is the same problem as described in this thread:
>> http://camel.465427.n5.nabble.com/CXF-Camel-JMS-Endpoint-exception-handl
>> ing-td4471175.html
>> <http://camel.465427.n5.nabble.com/CXF-Camel-JMS-Endpoint-exception-hand
>> ling-td4471175.html> ?
>>
>> Thanks for your help
>> Stefan

Re: Transacted CXF-Consumer from queue

Posted by Aki Yoshida <el...@googlemail.com>.
Hi,
Is this a jms -> cxf route scenario and you want to get an exception
from the cxf endpoint? In that case,  you need to set the synchronous
property at the camel-cxf endpoint.

http://camel.apache.org/cxf.html#CXF-URIformat

regards, aki

2012/3/21 Burkard Stephan <st...@visana.ch>:
> Hello
>
> I try to get running a SOAP over JMS usecase with the configuration
> outlined here:
> http://camel.apache.org/better-jms-transport-for-cxf-webservice-using-ap
> ache-camel.html
> <http://camel.apache.org/better-jms-transport-for-cxf-webservice-using-a
> pache-camel.html>
>
> My webservice is InOnly, it does not respond to requests. The client
> therefore sends SOAP messages to a queue without waiting for an answer.
> On the server side camel consumes the messages.
>
> I tried to test transaction behaviour of my camel routes with unittests
> where I advice the route with exceptions that occur at specific
> entpoints. This works fine when I consume from the queue directly
> (activemq:queue:...). If an error occurs the message is not commited and
> it stays in the queue.
> When I use a CXF endpoint to consume messages (cxf:bean:...), messages
> are lost when an exception occurs. They seem to be commited in activemq
> before or despite an error occurs.
> Therefore I tried to read first from the queue directly, forward the
> message to a direct endpoint and consume the messages with CXF from the
> direct endpoint. But in this case the message is also lost if an error
> occurs after consuming the message with CXF.
>
> Before posting routes and configuration details, I just would like to
> know if this is "normal" behaviour of the CXF endpoint with inOnly MEP
> or if the messages should stay in the queue as I expect?
>
> Perhaps this is the same problem as described in this thread:
> http://camel.465427.n5.nabble.com/CXF-Camel-JMS-Endpoint-exception-handl
> ing-td4471175.html
> <http://camel.465427.n5.nabble.com/CXF-Camel-JMS-Endpoint-exception-hand
> ling-td4471175.html> ?
>
> Thanks for your help
> Stefan