You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by jack nimble <ja...@gmail.com> on 2010/01/21 19:48:13 UTC

Best way to build an "async" service

Question 1: Can someone point out an of an client using an async service?
i.e. the service itself is async.

Question 2:

I'm putting together a web service which will accept a batch of XML, which
could be pretty big, and put it onto a jms queue for processing.

It's turning out to be a bit more complicated than I originally hoped. A
synchronous service would be easiest, and simplest, but what are the chances
of timing out? I'm not sure. So, I have been planning on an asynchronous
service, to play it safe.


For an asynchronous service, Axis2 relies on WS-addressing, which could have
firewall issues, per this post from Peer Reynders at
http://www.coderanch.com/t/224525/Web-Services/jav...hronous-Web-services-with-Axis<http://www.coderanch.com/t/224525/Web-Services/java/Asynchronous-Web-services-with-Axis>.


Peer suggested in that post that using a non-blocking client might work, but
that again poses the timeout issue.

Finally, to defeat the timeout problem, he suggests using a correlation
identifier, which means that the initial request is assigned an id which is
returned to the client. and have the client poll for the result, using the
id. A message handler to designed to ignore overly aggressive client polls
made within some threshold interval could be added ref
http://www.ibm.com/developerworks/webservices/library/ws-asynch2/#4

But, if I configure the service to be asynchronous, then it will create a
separate thread to do the processing - including writing to the queue. This
would lessen the chances of a timeout, correct?

For the acknowledgment, I could use a correlation identifier/batch number,
and maybe send an email to the client. I could get the email from the data
itself, or maybe I could look it up on for the customer locally. I don't
necessarily even need to send the client an acknowledgment, but it would
probably be a good idea.

Does this make sense? In other words, I need to make this service
asynchronous to lessen the risk of a timeout, right?