sendErrorOnTransport(new EurekaProtocolError("Unexpected message " + message));
protected void dispatchMessageFromClient(final Object message) { Observable<?> reply; if (message instanceof ReplicationHello) { logger.info("Received Hello from {}", ((ReplicationHello) message).getSourceId()); reply = hello((ReplicationHello) message); } else if (message instanceof RegisterCopy) { InstanceInfo instanceInfo = ((RegisterCopy) message).getInstanceInfo(); reply = register(instanceInfo);// No need to subscribe, the register() call does the subscription. } else if (message instanceof UnregisterCopy) { reply = unregister(((UnregisterCopy) message).getInstanceId());// No need to subscribe, the unregister() call does the subscription. } else { reply = Observable.error(new EurekaProtocolError("Unexpected message " + message)); } reply.ignoreElements().cast(Void.class).subscribe(new Subscriber<Void>() { @Override public void onCompleted() { // No-op } @Override public void onError(Throwable e) { sendErrorOnTransport(e); } @Override public void onNext(Void aVoid) { // No-op } }); }
sendErrorOnTransport(new EurekaProtocolError("Unexpected message " + message));
@Override public void call(Object message) { if (message instanceof Register) { InstanceInfo instanceInfo = ((Register) message).getInstanceInfo(); register(instanceInfo);// No need to subscribe, the register() call does the subscription. } else if (message instanceof Unregister) { unregister();// No need to subscribe, the unregister() call does the subscription. } else if (message instanceof Update) { InstanceInfo instanceInfo = ((Update) message).getInstanceInfo(); update(instanceInfo);// No need to subscribe, the update() call does the subscription. } else { sendErrorOnTransport(new EurekaProtocolError("Unexpected message " + message)); } } });
sendErrorOnTransport(new EurekaProtocolError("Unexpected message " + message));
protected void dispatchMessageFromClient(final Object message) { Observable<?> reply; if (message instanceof ReplicationHello) { reply = hello((ReplicationHello) message); } else if (message instanceof RegisterCopy) { InstanceInfo instanceInfo = ((RegisterCopy) message).getInstanceInfo(); reply = register(instanceInfo);// No need to subscribe, the register() call does the subscription. } else if (message instanceof UnregisterCopy) { reply = unregister(((UnregisterCopy) message).getInstanceId());// No need to subscribe, the unregister() call does the subscription. } else if (message instanceof UpdateCopy) { InstanceInfo instanceInfo = ((UpdateCopy) message).getInstanceInfo(); reply = update(instanceInfo);// No need to subscribe, the update() call does the subscription. } else { reply = Observable.error(new EurekaProtocolError("Unexpected message " + message)); } reply.ignoreElements().cast(Void.class).subscribe(new Subscriber<Void>() { @Override public void onCompleted() { // No-op } @Override public void onError(Throwable e) { sendErrorOnTransport(e); } @Override public void onNext(Void aVoid) { // No-op } }); }