org.yamcs.api.Observer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of yamcs-api Show documentation
Show all versions of yamcs-api Show documentation
Used by external clients to communicate with Yamcs
package org.yamcs.api;
public interface Observer {
/**
* Emit the next message.
*/
void next(T message);
/**
* Complete with an exception.
*/
void completeExceptionally(Throwable t);
/**
* Mark the successful end.
*/
void complete();
/**
* Shortcut for:
*
*
* next(message);
* complete();
*
*/
default void complete(T message) {
next(message);
complete();
}
/**
* Returns whether this call has been cancelled by the remote peer
*/
boolean isCancelled();
/**
* Set a {@link Runnable} that will be called when the call is cancelled. (example: peer disconnect)
*/
void setCancelHandler(Runnable cancelHandler);
}