axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Glen Daniels <>
Subject Re: [Axis2] org.apache.axis2.client.async.Callback#onError method signature
Date Mon, 07 May 2007 13:57:05 GMT
Hi dims!

Davanum Srinivas wrote:
> Does it make sense to change the method as follows? Basically add an
> extra paramter in onError?
> public abstract class Callback {
>    public abstract void onComplete(AsyncResult result);
>    public abstract void onError(Exception e, AsyncResult result);
> }

Hm... a couple of thoughts here.

First of all, is "onComplete()" really the right name for the callback? 
  If you have an MEP with multiple response messages, mightn't this get 
called a few times?  Perhaps onMessage() is better, and then we can have 
onComplete() be a separate callback to indicate that the MEP is done.

Second, what's the point of AsyncResult?  It contains nothing except a 
MessageContext right now.  Recommend dropping this class.

Third, why is Callback an abstract class and not just an interface? 
There doesn't seem to be enough going on there (really just setting the 
"complete" flag) to warrant the limitations that you get when extending 
instead of implementing.

Fourth, if you get an onError(), does that mean you a) received a fault 
message, or b) something went wrong on our side?  In other words, which 
MessageContext would we even be receiving here?  I think it would be 
clearer and cleaner to have all received messages, including faults, be 
handled by onMessage(), and then have onError() be explicitly for the 
case where something went wrong while sending.  Alternately I'd be ok 
with separate onFault() and onError().

So I'd propose the following:

public interface Callback {
    * Received a message, info in the MessageContext.  Might be a
    * fault, so check msgContext.isFault()!
   void onMessage(MessageContext msgContext);

    * Operation is complete.  (should we pass OperationContext?)
   void onComplete();

    * Something went wrong on our side!  The MessageContext
    * is the OUTGOING message.  Incoming faults will trigger the
    * onMessage() callback above.
   void onError(Exception e, MessageContext msgContext);



To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message