You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Henning Blohm <he...@zfabrik.de> on 2019/06/10 10:39:47 UTC

Robust Asynchronous Message Exchange using WS-Addressing

Hello CXF users,

I would like to ask for some advise on how to handle a
robust asynchronous message exchange using WS-Addressing and CXF.

So system A sends a message to system B for processing, and if B
accepts the message, system A will receive some later callback from B
conveying some information on how processing of the message worked out.

It should be possible for B to check on correctness of the message and
B should be able to setup whatever is needed for later (e.g. commit
some data to a database, put something into some queue) before it
confirms submission of message.

For non-technical reasons I would like to use WS-Addressing to communicate
the callback address.

I tried two approaches:

a) A One-Way service.

In that case, I noticed, CXF already returns an HTTP 202 (Accepted) reply
before the application has any chance to get its hands on the message.
I found no (harmless) way to have CXF wait for the application to check
and really "accept" the message.

I would really like to be able to validate the incoming message and safely
put it in a processing queue before replying with a 202 response.

Is that possible?


b) A Two-Way service with (empty) response message (even if no content)

In that case, using WS-Addressing CXF sends an empty SOAP response to the
replyTo address on its own with a new request after the method call
completed.

I would really like to be able to synchronously reply with a simple
message indicating whether submission was successful and if so, send
a more detailed processing message to the replyTo callback when processing
is done.

Is that possible?


So, in essence, I would like to use WS-Addressing to specify a callback
address and return some simple response synchronously for the incoming
call while using the callback address for a more detailed callback
later.

Would one of the two approaches above work or should I follow some
other direction.

Thanks,
Henning

RE: Robust Asynchronous Message Exchange using WS-Addressing

Posted by Andrei Shakirin <as...@talend.com.INVALID>.
Hi Henning,

There are some comments inline:

-----Original Message-----
From: Henning Blohm <he...@zfabrik.de> 
Sent: Freitag, 5. Juli 2019 12:33
To: users@cxf.apache.org
Subject: Re: Robust Asynchronous Message Exchange using WS-Addressing


Warning! External email. Exercise caution when opening attachments or clicking any links. 
 

>Hi Andrei,

>responding with a 202 is absolutely fine. Responding without giving the application a chance of deciding >whether the message makes sense is a little too aggressive.

Well, from my perspective 202 here just mean that message achieved the receiver and it can be processed. All other logic inclusive message validation will be fulfilled asynchronously.

>In the specific case, the other party is already existing and there was no way for us to change it. As far as >I can tell, the remote service was implemented using .Net.

>The way it works on their side is that WS-Addressing is used to supply a callback address (us in that >case)  but the first gets a real synchronous response indicating whether the original request was >accepted or not. If so, the callback address will be called later with the actual processing result. This is >the scenario b) below.

It is debatable is such behavior really in sense of asynchronous processing. But if you cannot change it, there is no choice.

>In order to achieve this behavior, we disabled WS-Addressing processing by CXF for the service >endpoint, so that there is no asynch response sent by CXF and turn addressing on again and set WS->Addressing data on an outbound interceptor.

This is a valid workaround to model communication using two one-way calls. Perhaps it will be enough just to remove ReplyTo header instead deactivating whole WS-Addressing - have to verify that.

>Thanks,
>Henning

Regards,
Andrei.

Am Do., 4. Juli 2019 um 17:29 Uhr schrieb Andrei Shakirin
<as...@talend.com.invalid>:

> Hi,
>
> 202 as response for one-way is designed. The idea is that client 
> thread must not wait for the response, it is asynchronous communication.
> There are three ways to implement this requirement:
> 1) use WS-Addressing and WSA-ReplyTo header
> 2) use two independent one-way calls
> 3) use native async transport JMX
>
> I described some details of this in
> https://urldefense.proofpoint.com/v2/url?u=http-3A__ashakirin-2Dcxf-2D
> async.blogspot.com_&d=DwIFaQ&c=2w5q_42kFG40MI2alLPgJw&r=bWOqkHjIZE0sZt
> dpFMIhm-lcbhtB3cv08OlIr0lkKR4&m=fTXPL5bP7fGYZEPkX5JYlLPaG5fN8YboN9EQUo
> WbWzA&s=nJhZd92wNxKzRp0_m3jm_Pi3zmdVg_d7oh0x0HSSJR0&e=
>
> Regards,
> Andrei.
>
> -----Original Message-----
> From: Henning Blohm <he...@zfabrik.de>
> Sent: Montag, 10. Juni 2019 12:40
> To: users@cxf.apache.org
> Subject: Robust Asynchronous Message Exchange using WS-Addressing
>
>
> Warning! External email. Exercise caution when opening attachments or 
> clicking any links.
>
>
> Hello CXF users,
>
> I would like to ask for some advise on how to handle a robust 
> asynchronous message exchange using WS-Addressing and CXF.
>
> So system A sends a message to system B for processing, and if B 
> accepts the message, system A will receive some later callback from B 
> conveying some information on how processing of the message worked out.
>
> It should be possible for B to check on correctness of the message and 
> B should be able to setup whatever is needed for later (e.g. commit 
> some data to a database, put something into some queue) before it 
> confirms submission of message.
>
> For non-technical reasons I would like to use WS-Addressing to 
> communicate the callback address.
>
> I tried two approaches:
>
> a) A One-Way service.
>
> In that case, I noticed, CXF already returns an HTTP 202 (Accepted) 
> reply before the application has any chance to get its hands on the message.
> I found no (harmless) way to have CXF wait for the application to 
> check and really "accept" the message.
>
> I would really like to be able to validate the incoming message and 
> safely put it in a processing queue before replying with a 202 response.
>
> Is that possible?
>
>
> b) A Two-Way service with (empty) response message (even if no 
> content)
>
> In that case, using WS-Addressing CXF sends an empty SOAP response to 
> the replyTo address on its own with a new request after the method 
> call completed.
>
> I would really like to be able to synchronously reply with a simple 
> message indicating whether submission was successful and if so, send a 
> more detailed processing message to the replyTo callback when processing is done.
>
> Is that possible?
>
>
> So, in essence, I would like to use WS-Addressing to specify a 
> callback address and return some simple response synchronously for the 
> incoming call while using the callback address for a more detailed callback later.
>
> Would one of the two approaches above work or should I follow some 
> other direction.
>
> Thanks,
> Henning
> As a recipient of an email from Talend, your contact personal data 
> will be on our systems. Please see our contacts privacy notice at 
> Talend, Inc. < https://www.talend.com/contacts-privacy-policy/>
>
>
>

--
Henning Blohm

henning.blohm@zfabrik.de
Linkedin <https://urldefense.proofpoint.com/v2/url?u=http-3A__www.linkedin.com_pub_henning-2Dblohm_0_7b5_628&d=DwIFaQ&c=2w5q_42kFG40MI2alLPgJw&r=bWOqkHjIZE0sZtdpFMIhm-lcbhtB3cv08OlIr0lkKR4&m=fTXPL5bP7fGYZEPkX5JYlLPaG5fN8YboN9EQUoWbWzA&s=fGDjech5bKse_uBIQ__a22mZMb7bpvo0N8m1YEetC2w&e= > ZFabrik <https://urldefense.proofpoint.com/v2/url?u=http-3A__www.zfabrik.de&d=DwIFaQ&c=2w5q_42kFG40MI2alLPgJw&r=bWOqkHjIZE0sZtdpFMIhm-lcbhtB3cv08OlIr0lkKR4&m=fTXPL5bP7fGYZEPkX5JYlLPaG5fN8YboN9EQUoWbWzA&s=VGR9tKs8BBajHSpchW0BKRgWc4blhktlvkAkbrCtsgE&e= > Blog <https://urldefense.proofpoint.com/v2/url?u=http-3A__www.z2-2Denvironment.net_blog&d=DwIFaQ&c=2w5q_42kFG40MI2alLPgJw&r=bWOqkHjIZE0sZtdpFMIhm-lcbhtB3cv08OlIr0lkKR4&m=fTXPL5bP7fGYZEPkX5JYlLPaG5fN8YboN9EQUoWbWzA&s=lE2VwelERk9M87kILCAGEvsT7lI26qTTak5WjfWbde8&e= > Z2-Environment <https://urldefense.proofpoint.com/v2/url?u=http-3A__www.z2-2Denvironment.eu&d=DwIFaQ&c=2w5q_42kFG40MI2alLPgJw&r=bWOqkHjIZE0sZtdpFMIhm-lcbhtB3cv08OlIr0lkKR4&m=fTXPL5bP7fGYZEPkX5JYlLPaG5fN8YboN9EQUoWbWzA&s=0XxDjkFimGE0whWe2nzhqfLqReKxo5p__We8JQ8dvcI&e= >
Z2 Wiki <https://urldefense.proofpoint.com/v2/url?u=http-3A__redmine.z2-2Denvironment.net&d=DwIFaQ&c=2w5q_42kFG40MI2alLPgJw&r=bWOqkHjIZE0sZtdpFMIhm-lcbhtB3cv08OlIr0lkKR4&m=fTXPL5bP7fGYZEPkX5JYlLPaG5fN8YboN9EQUoWbWzA&s=gEfVAWhwSLvNiDyOlyjxEa1SZXzemBdNM-EOCDB7opc&e= >

T: +49 6227 3984255
F: +49 6227 3984254
M: +49 1781891820

*ZFabrik Software GmbH & Co. KG*
Lammstrasse 2, 69190 Walldorf
Handelsregister: Amtsgericht Mannheim HRA 702598 Persönlich haftende Gesellschafterin: ZFabrik Verwaltungs GmbH, Sitz Walldorf
Geschäftsführer: Dr. H. Blohm u. Udo Offermann
Handelsregister: Amtsgericht Mannheim HRB 723699

Re: Robust Asynchronous Message Exchange using WS-Addressing

Posted by Daniel Kulp <dk...@apache.org>.
If you set an endpoint property of “org.apache.cxf.oneway.robust” to “true” on the service, the one ways are handled very differently.   It MAY work for your case, but I’m not really sure.   The 202 is sent back AFTER the service is called, but before the response message is called.    It may be what you need.   

Dan



> On Jul 5, 2019, at 6:32 AM, Henning Blohm <he...@zfabrik.de> wrote:
> 
> Hi Andrei,
> 
> responding with a 202 is absolutely fine. Responding without giving the
> application a chance of deciding whether the message makes sense is a
> little too aggressive.
> 
> In the specific case, the other party is already existing and there was no
> way for us to change it. As far as I can tell, the remote service was
> implemented using .Net.
> 
> The way it works on their side is that WS-Addressing is used to supply a
> callback address (us in that case)  but the first gets a real synchronous
> response indicating whether the original request was accepted or not. If
> so, the callback address will be called later with the actual processing
> result. This is the scenario b) below.
> 
> In order to achieve this behavior, we disabled WS-Addressing processing by
> CXF for the service endpoint, so that there is no asynch response sent by
> CXF and turn addressing on again and set WS-Addressing data on an outbound
> interceptor.
> 
> Thanks,
> Henning
> 
> Am Do., 4. Juli 2019 um 17:29 Uhr schrieb Andrei Shakirin
> <as...@talend.com.invalid>:
> 
>> Hi,
>> 
>> 202 as response for one-way is designed. The idea is that client thread
>> must not wait for the response, it is asynchronous communication.
>> There are three ways to implement this requirement:
>> 1) use WS-Addressing and WSA-ReplyTo header
>> 2) use two independent one-way calls
>> 3) use native async transport JMX
>> 
>> I described some details of this in
>> http://ashakirin-cxf-async.blogspot.com/
>> 
>> Regards,
>> Andrei.
>> 
>> -----Original Message-----
>> From: Henning Blohm <he...@zfabrik.de>
>> Sent: Montag, 10. Juni 2019 12:40
>> To: users@cxf.apache.org
>> Subject: Robust Asynchronous Message Exchange using WS-Addressing
>> 
>> 
>> Warning! External email. Exercise caution when opening attachments or
>> clicking any links.
>> 
>> 
>> Hello CXF users,
>> 
>> I would like to ask for some advise on how to handle a robust asynchronous
>> message exchange using WS-Addressing and CXF.
>> 
>> So system A sends a message to system B for processing, and if B accepts
>> the message, system A will receive some later callback from B conveying
>> some information on how processing of the message worked out.
>> 
>> It should be possible for B to check on correctness of the message and B
>> should be able to setup whatever is needed for later (e.g. commit some data
>> to a database, put something into some queue) before it confirms submission
>> of message.
>> 
>> For non-technical reasons I would like to use WS-Addressing to communicate
>> the callback address.
>> 
>> I tried two approaches:
>> 
>> a) A One-Way service.
>> 
>> In that case, I noticed, CXF already returns an HTTP 202 (Accepted) reply
>> before the application has any chance to get its hands on the message.
>> I found no (harmless) way to have CXF wait for the application to check
>> and really "accept" the message.
>> 
>> I would really like to be able to validate the incoming message and safely
>> put it in a processing queue before replying with a 202 response.
>> 
>> Is that possible?
>> 
>> 
>> b) A Two-Way service with (empty) response message (even if no content)
>> 
>> In that case, using WS-Addressing CXF sends an empty SOAP response to the
>> replyTo address on its own with a new request after the method call
>> completed.
>> 
>> I would really like to be able to synchronously reply with a simple
>> message indicating whether submission was successful and if so, send a more
>> detailed processing message to the replyTo callback when processing is done.
>> 
>> Is that possible?
>> 
>> 
>> So, in essence, I would like to use WS-Addressing to specify a callback
>> address and return some simple response synchronously for the incoming call
>> while using the callback address for a more detailed callback later.
>> 
>> Would one of the two approaches above work or should I follow some other
>> direction.
>> 
>> Thanks,
>> Henning
>> As a recipient of an email from Talend, your contact personal data will be
>> on our systems. Please see our contacts privacy notice at Talend, Inc. <
>> https://www.talend.com/contacts-privacy-policy/>
>> 
>> 
>> 
> 
> -- 
> Henning Blohm
> 
> henning.blohm@zfabrik.de
> Linkedin <http://www.linkedin.com/pub/henning-blohm/0/7b5/628>
> ZFabrik <http://www.zfabrik.de>
> Blog <http://www.z2-environment.net/blog>
> Z2-Environment <http://www.z2-environment.eu>
> Z2 Wiki <http://redmine.z2-environment.net>
> 
> T: +49 6227 3984255
> F: +49 6227 3984254
> M: +49 1781891820
> 
> *ZFabrik Software GmbH & Co. KG*
> Lammstrasse 2, 69190 Walldorf
> Handelsregister: Amtsgericht Mannheim HRA 702598
> Persönlich haftende Gesellschafterin: ZFabrik Verwaltungs GmbH, Sitz
> Walldorf
> Geschäftsführer: Dr. H. Blohm u. Udo Offermann
> Handelsregister: Amtsgericht Mannheim HRB 723699

-- 
Daniel Kulp
dkulp@apache.org <ma...@apache.org> - http://dankulp.com/blog <http://dankulp.com/blog>
Talend Community Coder - http://talend.com <http://coders.talend.com/>

Re: Robust Asynchronous Message Exchange using WS-Addressing

Posted by Henning Blohm <he...@zfabrik.de>.
Hi Andrei,

responding with a 202 is absolutely fine. Responding without giving the
application a chance of deciding whether the message makes sense is a
little too aggressive.

In the specific case, the other party is already existing and there was no
way for us to change it. As far as I can tell, the remote service was
implemented using .Net.

The way it works on their side is that WS-Addressing is used to supply a
callback address (us in that case)  but the first gets a real synchronous
response indicating whether the original request was accepted or not. If
so, the callback address will be called later with the actual processing
result. This is the scenario b) below.

In order to achieve this behavior, we disabled WS-Addressing processing by
CXF for the service endpoint, so that there is no asynch response sent by
CXF and turn addressing on again and set WS-Addressing data on an outbound
interceptor.

Thanks,
Henning

Am Do., 4. Juli 2019 um 17:29 Uhr schrieb Andrei Shakirin
<as...@talend.com.invalid>:

> Hi,
>
> 202 as response for one-way is designed. The idea is that client thread
> must not wait for the response, it is asynchronous communication.
> There are three ways to implement this requirement:
> 1) use WS-Addressing and WSA-ReplyTo header
> 2) use two independent one-way calls
> 3) use native async transport JMX
>
> I described some details of this in
> http://ashakirin-cxf-async.blogspot.com/
>
> Regards,
> Andrei.
>
> -----Original Message-----
> From: Henning Blohm <he...@zfabrik.de>
> Sent: Montag, 10. Juni 2019 12:40
> To: users@cxf.apache.org
> Subject: Robust Asynchronous Message Exchange using WS-Addressing
>
>
> Warning! External email. Exercise caution when opening attachments or
> clicking any links.
>
>
> Hello CXF users,
>
> I would like to ask for some advise on how to handle a robust asynchronous
> message exchange using WS-Addressing and CXF.
>
> So system A sends a message to system B for processing, and if B accepts
> the message, system A will receive some later callback from B conveying
> some information on how processing of the message worked out.
>
> It should be possible for B to check on correctness of the message and B
> should be able to setup whatever is needed for later (e.g. commit some data
> to a database, put something into some queue) before it confirms submission
> of message.
>
> For non-technical reasons I would like to use WS-Addressing to communicate
> the callback address.
>
> I tried two approaches:
>
> a) A One-Way service.
>
> In that case, I noticed, CXF already returns an HTTP 202 (Accepted) reply
> before the application has any chance to get its hands on the message.
> I found no (harmless) way to have CXF wait for the application to check
> and really "accept" the message.
>
> I would really like to be able to validate the incoming message and safely
> put it in a processing queue before replying with a 202 response.
>
> Is that possible?
>
>
> b) A Two-Way service with (empty) response message (even if no content)
>
> In that case, using WS-Addressing CXF sends an empty SOAP response to the
> replyTo address on its own with a new request after the method call
> completed.
>
> I would really like to be able to synchronously reply with a simple
> message indicating whether submission was successful and if so, send a more
> detailed processing message to the replyTo callback when processing is done.
>
> Is that possible?
>
>
> So, in essence, I would like to use WS-Addressing to specify a callback
> address and return some simple response synchronously for the incoming call
> while using the callback address for a more detailed callback later.
>
> Would one of the two approaches above work or should I follow some other
> direction.
>
> Thanks,
> Henning
> As a recipient of an email from Talend, your contact personal data will be
> on our systems. Please see our contacts privacy notice at Talend, Inc. <
> https://www.talend.com/contacts-privacy-policy/>
>
>
>

-- 
Henning Blohm

henning.blohm@zfabrik.de
Linkedin <http://www.linkedin.com/pub/henning-blohm/0/7b5/628>
ZFabrik <http://www.zfabrik.de>
Blog <http://www.z2-environment.net/blog>
Z2-Environment <http://www.z2-environment.eu>
Z2 Wiki <http://redmine.z2-environment.net>

T: +49 6227 3984255
F: +49 6227 3984254
M: +49 1781891820

*ZFabrik Software GmbH & Co. KG*
Lammstrasse 2, 69190 Walldorf
Handelsregister: Amtsgericht Mannheim HRA 702598
Persönlich haftende Gesellschafterin: ZFabrik Verwaltungs GmbH, Sitz
Walldorf
Geschäftsführer: Dr. H. Blohm u. Udo Offermann
Handelsregister: Amtsgericht Mannheim HRB 723699

RE: Robust Asynchronous Message Exchange using WS-Addressing

Posted by Andrei Shakirin <as...@talend.com.INVALID>.
Hi,

202 as response for one-way is designed. The idea is that client thread must not wait for the response, it is asynchronous communication.
There are three ways to implement this requirement:
1) use WS-Addressing and WSA-ReplyTo header
2) use two independent one-way calls
3) use native async transport JMX

I described some details of this in http://ashakirin-cxf-async.blogspot.com/

Regards,
Andrei.

-----Original Message-----
From: Henning Blohm <he...@zfabrik.de>
Sent: Montag, 10. Juni 2019 12:40
To: users@cxf.apache.org
Subject: Robust Asynchronous Message Exchange using WS-Addressing


Warning! External email. Exercise caution when opening attachments or clicking any links.


Hello CXF users,

I would like to ask for some advise on how to handle a robust asynchronous message exchange using WS-Addressing and CXF.

So system A sends a message to system B for processing, and if B accepts the message, system A will receive some later callback from B conveying some information on how processing of the message worked out.

It should be possible for B to check on correctness of the message and B should be able to setup whatever is needed for later (e.g. commit some data to a database, put something into some queue) before it confirms submission of message.

For non-technical reasons I would like to use WS-Addressing to communicate the callback address.

I tried two approaches:

a) A One-Way service.

In that case, I noticed, CXF already returns an HTTP 202 (Accepted) reply before the application has any chance to get its hands on the message.
I found no (harmless) way to have CXF wait for the application to check and really "accept" the message.

I would really like to be able to validate the incoming message and safely put it in a processing queue before replying with a 202 response.

Is that possible?


b) A Two-Way service with (empty) response message (even if no content)

In that case, using WS-Addressing CXF sends an empty SOAP response to the replyTo address on its own with a new request after the method call completed.

I would really like to be able to synchronously reply with a simple message indicating whether submission was successful and if so, send a more detailed processing message to the replyTo callback when processing is done.

Is that possible?


So, in essence, I would like to use WS-Addressing to specify a callback address and return some simple response synchronously for the incoming call while using the callback address for a more detailed callback later.

Would one of the two approaches above work or should I follow some other direction.

Thanks,
Henning
As a recipient of an email from Talend, your contact personal data will be on our systems. Please see our contacts privacy notice at Talend, Inc. <https://www.talend.com/contacts-privacy-policy/>