use of org.jowidgets.invocation.common.impl.AcknowledgeMessage in project jo-client-platform by jo-source.
the class InvocationCallbackMessageReceiver method onMessage.
@Override
public void onMessage(final Object message, final IMessageChannel replyChannel) {
if (message instanceof AcknowledgeMessage) {
final AcknowledgeMessage acknowledgeMessage = (AcknowledgeMessage) message;
invocationClient.registerAcknowledge(acknowledgeMessage.getInvocationId(), replyChannel);
} else if (message instanceof FinishedMessage) {
invocationClientServiceRegistry.onFinished((FinishedMessage) message);
} else if (message instanceof ExceptionMessage) {
invocationClientServiceRegistry.onException((ExceptionMessage) message);
} else if (message instanceof InterimResponseMessage) {
invocationClientServiceRegistry.onInterimResponse((InterimResponseMessage) message);
} else if (message instanceof InterimRequestMessage) {
final InterimRequestMessage interimRequestMessage = (InterimRequestMessage) message;
invocationClient.registerInterimRequest(interimRequestMessage.getInvocationId(), interimRequestMessage.getRequestId(), replyChannel);
invocationClientServiceRegistry.onInterimRequest((InterimRequestMessage) message);
}
}
use of org.jowidgets.invocation.common.impl.AcknowledgeMessage in project jo-client-platform by jo-source.
the class InvocationServerMessageReceiver method onMessage.
@Override
public void onMessage(final Object message, final IMessageChannel replyChannel) {
if (message instanceof MethodInvocationMessage) {
final MethodInvocationMessage invocationMessage = (MethodInvocationMessage) message;
final Object invocationId = invocationMessage.getInvocationId();
invocationServer.registerInvocation(invocationId, replyChannel);
final IExceptionCallback exceptionCallback = new IExceptionCallback() {
@Override
public void exception(final Throwable throwable) {
invocationServer.unregisterInvocation(invocationId);
invocationServerServiceRegistry.onCancel(invocationId);
}
};
replyChannel.send(new AcknowledgeMessage(invocationId), exceptionCallback);
invocationServerServiceRegistry.onMethodInvocation((MethodInvocationMessage) message);
} else if (message instanceof CancelMessage) {
final CancelMessage cancelMessage = (CancelMessage) message;
invocationServerServiceRegistry.onCancel(cancelMessage);
invocationServer.unregisterInvocation(cancelMessage.getInvocationId());
} else if (message instanceof ResponseMessage) {
invocationServerServiceRegistry.onResponse((ResponseMessage) message);
}
}
Aggregations