Search in sources :

Example 1 with AcknowledgeMessage

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);
    }
}
Also used : ExceptionMessage(org.jowidgets.invocation.common.impl.ExceptionMessage) InterimResponseMessage(org.jowidgets.invocation.common.impl.InterimResponseMessage) InterimRequestMessage(org.jowidgets.invocation.common.impl.InterimRequestMessage) AcknowledgeMessage(org.jowidgets.invocation.common.impl.AcknowledgeMessage) FinishedMessage(org.jowidgets.invocation.common.impl.FinishedMessage)

Example 2 with AcknowledgeMessage

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);
    }
}
Also used : CancelMessage(org.jowidgets.invocation.common.impl.CancelMessage) MethodInvocationMessage(org.jowidgets.invocation.common.impl.MethodInvocationMessage) AcknowledgeMessage(org.jowidgets.invocation.common.impl.AcknowledgeMessage) IExceptionCallback(org.jowidgets.message.api.IExceptionCallback) ResponseMessage(org.jowidgets.invocation.common.impl.ResponseMessage)

Aggregations

AcknowledgeMessage (org.jowidgets.invocation.common.impl.AcknowledgeMessage)2 CancelMessage (org.jowidgets.invocation.common.impl.CancelMessage)1 ExceptionMessage (org.jowidgets.invocation.common.impl.ExceptionMessage)1 FinishedMessage (org.jowidgets.invocation.common.impl.FinishedMessage)1 InterimRequestMessage (org.jowidgets.invocation.common.impl.InterimRequestMessage)1 InterimResponseMessage (org.jowidgets.invocation.common.impl.InterimResponseMessage)1 MethodInvocationMessage (org.jowidgets.invocation.common.impl.MethodInvocationMessage)1 ResponseMessage (org.jowidgets.invocation.common.impl.ResponseMessage)1 IExceptionCallback (org.jowidgets.message.api.IExceptionCallback)1