@Override public Observable<? extends Void> call(MessageConnection connection) { return connection.submitWithAck(Unregister.INSTANCE); } });
@Override public Observable<Void> submitWithAck(Object message, long timeout) { return delegate.submitWithAck(message, timeout); }
@Override public Observable<Void> submitWithAck(Object message) { return delegate.submitWithAck(message); }
@Override public Observable<Void> submitWithAck(Object message, long timeout) { return delegate.submitWithAck(message, timeout); }
@Override public Observable<Void> submitWithAck(Object message) { return delegate.submitWithAck(message); }
@Override public Observable<? extends Void> call(MessageConnection connection) { return connection.submitWithAck(new Update(newInfo)); } });
@Override public Observable<? extends Void> call(MessageConnection connection) { return connection.submitWithAck(new Register(instanceInfo)); } });
protected <T> Observable<Void> sendExpectAckOnConnection(MessageConnection connection, T message) { if (logger.isDebugEnabled()) { logger.debug("Sending message to the server: {}", message); } return subscribeToTransportSend(connection.submitWithAck(message), message.getClass().getSimpleName()); }
@Override public Observable<Void> call(MessageConnection serverConnection) { return serverConnection.submitWithAck(new InterestRegistration(newInterest)) .doOnCompleted(new UpdateLocalInterest(newInterest)); } });
private Observable<Void> sendNotification(ChangeNotification<InstanceInfo> notification) { switch (notification.getKind()) { case Add: return transport.submitWithAck(new AddInstance(notification.getData())); case Delete: return transport.submitWithAck(new DeleteInstance(notification.getData().getId())); case Modify: final ModifyNotification<InstanceInfo> modifyNotification = (ModifyNotification<InstanceInfo>) notification; /** * Below will only work correctly if {@link MessageBroker#submitWithAck(Object)} is a lazy submit i.e. * the message is only sent over the wire when subscribed. If it is eager i.e. the message is written * to the underlying connection without subscription then {@link Observable#concatWith(Observable)} * will eagerly write all the messages without waiting for an ack. */ Observable<Void> toReturn = null; for (final Delta<?> delta : modifyNotification.getDelta()) { if (null == toReturn) { toReturn = transport.submitWithAck(new UpdateInstanceInfo(delta)); } else { toReturn.concatWith(transport.submitWithAck(new UpdateInstanceInfo(delta))); } } return toReturn; case BufferSentinel: return transport.submitWithAck(new StreamStateUpdate((StreamStateNotification<InstanceInfo>) notification)); } return Observable.error(new IllegalArgumentException("Unknown change notification type: " + notification.getKind())); }
public Observable<Void> sendNotification(ChangeNotification<InstanceInfo> notification) { switch (notification.getKind()) { case Add: return transport.submitWithAck(new AddInstance(notification.getData())); case Delete: return transport.submitWithAck(new DeleteInstance(notification.getData().getId())); case Modify: final ModifyNotification<InstanceInfo> modifyNotification = (ModifyNotification<InstanceInfo>) notification; /** * Below will only work correctly if {@link MessageBroker#submitWithAck(Object)} is a lazy submit i.e. * the message is only sent over the wire when subscribed. If it is eager i.e. the message is written * to the underlying connection without subscription then {@link Observable#concatWith(Observable)} * will eagerly write all the messages without waiting for an ack. */ Observable<Void> toReturn = null; for (final Delta<?> delta : modifyNotification.getDelta()) { if (null == toReturn) { toReturn = transport.submitWithAck(new UpdateInstanceInfo(delta)); } else { toReturn.concatWith(transport.submitWithAck(new UpdateInstanceInfo(delta))); } } return toReturn; } return Observable.error(new IllegalArgumentException("Unknown change notification type: " + notification.getKind())); }