You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ode.apache.org by Thilina Gunarathne <cs...@gmail.com> on 2008/02/07 23:24:15 UTC

Asynchronous web service invocation from BPEL

Hi all,
I'm trying to migrate a large distributed system[1] which uses an older BPEL
*like* workflow engine to use ODE.. In that system the "invoke" is always
asynchronous, so as in all our use cases. I want to migrate to ODE from it
with the least amount of changes to the BPEL docs.

I'm curious whether using a "invoke" followed by a "receive" together with
correlation is the only standard way to call an external web service
asynchronously in BPEL?  Is there any way to do that just using an invoke
only?? If not is there any custom ODE mechanisms to inform the engine that
this invoke is aysnc??

In the worst case I'm thinking of hacking the ODE Axis2 client to work
asynchronously (dual channel with addressing reply to) all the time. Does
any of the ODE guru's see any potential issues with other parts of ODE when
I do that..

thanks,
Thilina

[1] https://portal.leadproject.org/

Re: Asynchronous web service invocation from BPEL

Posted by Jens Goldhammer <je...@googlemail.com>.
Hello Alex,

I think, this is a good question for the axis2 mailing list.
AFAIK, Axis2 have a module called Sandesha2 which supports reliable 
Messaging out of the box according to the WS-ReliableMessaging-spec 
which was released in final version in the middle of 2007. The 
developers from wso2.org have developed a persistence mode for it, so 
that it must be possible to get all messages, even if ODE or the 
external service get an error and will be restarted. If you start an 
async invocation with Axis2 over a seperate channel, the internal 
simpleHTTPServer of Axis2 will be started and wait for an incoming 
message. I think, the problem is how to restore the listener after a 
crash...

I have started a thread in the nabble forum:
http://www.nabble.com/question-to-restore-callback-listener-after-crash-td15496163.html

Thanks,
Jens

Alex Boisvert schrieb:
> On 2/14/08, Thilina Gunarathne <cs...@gmail.com> wrote:
>   
>> Hi Alex,
>> Thanks a lot for the crystal clear explanation. I'll try to hack this in
>> my
>> system over the weekend and let you guys know if there are any
>> complications.
>>     
>
>
> After sending my email, I started thinking about reliability aspects and
> what would happen if a failure happened during the [Any amount of time]
> portion.
>
> How would you reliably handle an async response in Axis2?  (Assuming the
> callback is gone after a failure)
>
> alex
>
>   


Re: Asynchronous web service invocation from BPEL

Posted by Alex Boisvert <bo...@intalio.com>.
On 2/14/08, Thilina Gunarathne <cs...@gmail.com> wrote:
>
> Hi Alex,
> Thanks a lot for the crystal clear explanation. I'll try to hack this in
> my
> system over the weekend and let you guys know if there are any
> complications.


After sending my email, I started thinking about reliability aspects and
what would happen if a failure happened during the [Any amount of time]
portion.

How would you reliably handle an async response in Axis2?  (Assuming the
callback is gone after a failure)

alex

Re: Asynchronous web service invocation from BPEL

Posted by Thilina Gunarathne <cs...@gmail.com>.
Hi Alex,
Thanks a lot for the crystal clear explanation. I'll try to hack this in my
system over the weekend and let you guys know if there are any
complications.

thanks again,
Thilina

On Sun, Feb 10, 2008 at 11:59 PM, Alex Boisvert <bo...@intalio.com>
wrote:

> On 2/9/08, Thilina Gunarathne <cs...@gmail.com> wrote:
> >
> > The behavior is set at the message exchange level.  The IL is
> responsible
> > to
> > > call replyAsync() for asynchronous replies.  In the synchronous case,
> it
> > > would directly call on of reply() or replyWithFault().
> >
> > I'm a bit confused... In the Axis2 integration code, I see only
> > synchronous
> > external invokes only.. According to what I understood, if it's
> > request-reply, then ode creates a ODE schedulable object and pass it to
> > the
> > scheduler.. Then calls replyAsync().. But the actual invocation seems to
> > happen in a sync way, though ODE sees it as async due to the scheduler.
> > Please correct me if I understood anything wrong..
>
> Our external services can take hours to respond.. So I'm looking for
> > transport level asynchronousy using addressing reply-to..
>
>
> Oh, sorry, I wasn't clear.  What I meant to say is that it would be
> possible
> do to async invocation, not that everything was in place.  The code as is
> it
> today supports asynchronous invocations (e.g. JMS) but holds a thread
> while
> doing so, because it uses the synchronous Axis2 ServiceClient API.
>
> Here's how the interaction would look like for a "true" asynchronous
> invoke,
>
> 1) Engine calls PartnerRoleChannel.invoke(odeMex), which is implemented by
> ExternalService in the Axis2 IL.
> 2) ExternalService registers a JTA synchronization, and calls
> odeMex.replyAsync()
> 3) Engine commits transaction, causing JTA synchronization to be called
> 4) Synchronization performs the actual invoke, sending a request message
> via
> Axis2 OperationClient.execute() and registering a Callback for the
> response
>
> [Any amount of time here]
>
> 5) Response message is received in Axis2, Callback is called, and Callback
> calls ExternalService.reply()
> 6) ExternalService calls odeMex.reply(response)
>
> So the only thing that's missing right now is registering a Callback (in
> #4
> above) and wiring it to call ExternalService.reply (#5).
>
> Makes sense?
>
> alex
>



-- 
Thilina Gunarathne - http://thilinag.blogspot.com

Re: Asynchronous web service invocation from BPEL

Posted by Alex Boisvert <bo...@intalio.com>.
On 2/9/08, Thilina Gunarathne <cs...@gmail.com> wrote:
>
> The behavior is set at the message exchange level.  The IL is responsible
> to
> > call replyAsync() for asynchronous replies.  In the synchronous case, it
> > would directly call on of reply() or replyWithFault().
>
> I'm a bit confused... In the Axis2 integration code, I see only
> synchronous
> external invokes only.. According to what I understood, if it's
> request-reply, then ode creates a ODE schedulable object and pass it to
> the
> scheduler.. Then calls replyAsync().. But the actual invocation seems to
> happen in a sync way, though ODE sees it as async due to the scheduler.
> Please correct me if I understood anything wrong..

Our external services can take hours to respond.. So I'm looking for
> transport level asynchronousy using addressing reply-to..


Oh, sorry, I wasn't clear.  What I meant to say is that it would be possible
do to async invocation, not that everything was in place.  The code as is it
today supports asynchronous invocations (e.g. JMS) but holds a thread while
doing so, because it uses the synchronous Axis2 ServiceClient API.

Here's how the interaction would look like for a "true" asynchronous invoke,

1) Engine calls PartnerRoleChannel.invoke(odeMex), which is implemented by
ExternalService in the Axis2 IL.
2) ExternalService registers a JTA synchronization, and calls
odeMex.replyAsync()
3) Engine commits transaction, causing JTA synchronization to be called
4) Synchronization performs the actual invoke, sending a request message via
Axis2 OperationClient.execute() and registering a Callback for the response

[Any amount of time here]

5) Response message is received in Axis2, Callback is called, and Callback
calls ExternalService.reply()
6) ExternalService calls odeMex.reply(response)

So the only thing that's missing right now is registering a Callback (in #4
above) and wiring it to call ExternalService.reply (#5).

Makes sense?

alex

Re: Asynchronous web service invocation from BPEL

Posted by Thilina Gunarathne <cs...@gmail.com>.
Hi Alex,
Thanks a lot for the reply..

The behavior is set at the message exchange level.  The IL is responsible to
> call replyAsync() for asynchronous replies.  In the synchronous case, it
> would directly call on of reply() or replyWithFault().


I'm a bit confused... In the Axis2 integration code, I see only synchronous
external invokes only.. According to what I understood, if it's
request-reply, then ode creates a ODE schedulable object and pass it to the
scheduler.. Then calls replyAsync().. But the actual invocation seems to
happen in a sync way, though ODE sees it as async due to the scheduler.
Please correct me if I understood anything wrong..

Our external services can take hours to respond.. So I'm looking for
transport level asynchronousy using addressing reply-to..

thanks,
Thilina

>
>
> The outgoing MEX interface is defined here,
>
> http://svn.apache.org/repos/asf/ode/branches/APACHE_ODE_1.1/bpel-api/src/main/java/org/apache/ode/bpel/iapi/PartnerRoleMessageExchange.java
>
> and you can see our integration with Axis2 here,
>
> http://svn.apache.org/repos/asf/ode/branches/APACHE_ODE_1.1/axis2/src/main/java/org/apache/ode/axis2/ExternalService.java
>
> alex
>



-- 
Thilina Gunarathne  - http://thilinag.blogspot.com

Re: Asynchronous web service invocation from BPEL

Posted by Alex Boisvert <bo...@intalio.com>.
On 2/8/08, Thilina Gunarathne <cs...@gmail.com> wrote:
>
> When using <bpel:invoke> only, what is the mechanism to inform the ODE
> engine that this needs to be an async invocation.  Is there a global
> switch
> which I can turn ON to make all invocations async...


The behavior is set at the message exchange level.  The IL is responsible to
call replyAsync() for asynchronous replies.  In the synchronous case, it
would directly call on of reply() or replyWithFault().

The outgoing MEX interface is defined here,
http://svn.apache.org/repos/asf/ode/branches/APACHE_ODE_1.1/bpel-api/src/main/java/org/apache/ode/bpel/iapi/PartnerRoleMessageExchange.java

and you can see our integration with Axis2 here,
http://svn.apache.org/repos/asf/ode/branches/APACHE_ODE_1.1/axis2/src/main/java/org/apache/ode/axis2/ExternalService.java

alex

Re: Asynchronous web service invocation from BPEL

Posted by Thilina Gunarathne <cs...@gmail.com>.
Hi,
That's good news..

Using a <bpel:invoke> only should work.    The IL supports asynchronous
> replies.

When using <bpel:invoke> only, what is the mechanism to inform the ODE
engine that this needs to be an async invocation.  Is there a global switch
which I can turn ON to make all invocations async...

thanks,
Thilina

>
>
> alex
>



-- 
Thilina Gunarathne  - http://thilinag.blogspot.com

Re: Asynchronous web service invocation from BPEL

Posted by Alex Boisvert <bo...@intalio.com>.
On 2/7/08, Thilina Gunarathne <cs...@gmail.com> wrote:
>
> Hi all,
> I'm trying to migrate a large distributed system[1] which uses an older
> BPEL
> *like* workflow engine to use ODE.. In that system the "invoke" is always
> asynchronous, so as in all our use cases. I want to migrate to ODE from it
> with the least amount of changes to the BPEL docs.
>
> I'm curious whether using a "invoke" followed by a "receive" together with
> correlation is the only standard way to call an external web service
> asynchronously in BPEL?  Is there any way to do that just using an invoke
> only?? If not is there any custom ODE mechanisms to inform the engine that
> this invoke is aysnc??


Using a <bpel:invoke> only should work.    The IL supports asynchronous
replies.

alex