com.industry.rx_epl.Subscriber <>
A Subscriber contains the callbacks used when a subscription receives a value/error/complete. It is passed to the .subscribe(...) method.
Note: Subscribers should not be reused for multiple subscriptions.
# static .create() returns Subscriber <>
Creates a new Subscriber.
Observable.fromValues([1,2,3])
.subscribe(Subscriber.create().onNext(...).onError(...).onComplete(...));
# .onNext(callback:
action<T>) returns Subscriber <>
Register a callback to be called whenever the subscription receives a value.
action logInteger(integer x) {
log x.toString();
}
Observable.fromValues([1,2,3])
.subscribe(Subscriber.create().onNext(logInteger));
# .onComplete(callback:
action<>) returns Subscriber <>
Register a callback to be called when the subscription completes.
action logDone() {
log "Done";
}
Observable.fromValues([1,2,3])
.subscribe(Subscriber.create().onComplete(logDone));
# .onError(callback:
action<E>) returns Subscriber <>
Register a callback to be called when the subscription receives an error. The error can be of any type but is usually com.apama.exceptions.Exception
.
Note: The subscription is terminated when an error is received.
Note: If no error handler is registered then the default handler rethrows the exception.
action logError(com.apama.exceptions.Exception e) {
log e.getMessage();
}
Observable.error()
.subscribe(Subscriber.create().onError(logError));