I wrote an abstract class implementing Callback interface which
"wraps" the onMessage method, so that after the onMessage method is
called, it will call dispose on the subscription and fiber. So in all
successful tests the user need not bother to call dispose. However for
messages that never arrive, the user still has to call it manually. Is
there a better way to do this? Meaning some way in which the user
never needs to call dispose.
Code in the abstract class is provided for reference. The "done"
method inturn calls the dispose method on the subscription and fiber.
public void onMessage(Message message)
{
try{
this.message = message;
if(null != message.getException()){
throw message.getException();
}
onCallback(message);
done();
}catch(Exception e){
LOG.error("Error occurred during callback execution",e);
if(null == message.getException()){
message.setException(e);
}
}
}
abstract public void onCallback(Message message);
Calling dispose on each message delivery doesn't sound like an ideal
implementation. Channel subscriptions should be long lived and
typically exist for the lifetime of a fiber. Why are the
subscriptions disposed so often?
Mike
> --
> You received this message because you are subscribed to the Google Groups "jetlang-dev" group.
> To post to this group, send email to jetla...@googlegroups.com.
> To unsubscribe from this group, send email to jetlang-dev...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/jetlang-dev?hl=en.
>
I have open sourced this code now (https://github.com/menacher/Test-
Tools) . The reason for frequent unsubscribe is that integration test
cases subscribe for an incoming SOAP message using callbacks, do some
logic(mostly provide appropriate reply) and since this test is over
the dispose is called to release resources.
B.t.w, I am using this for testing our product and its working fine,
but as you said it may not be optimal design.
Abraham.
https://github.com/menacher/Test-Tools
Wiki:
https://github.com/menacher/Test-Tools/wiki
On Dec 11, 11:24 am, Abraham Menacherry <abrahammenache...@gmail.com>
wrote:
Mike
> > For more options, visit this group athttp://groups.google.com/group/jetlang-dev?hl=en.- Hide quoted text -
>
> - Show quoted text -