CacheUntilConnectSubscriber

final class CacheUntilConnectSubscriber[-A] extends Subscriber[A]

Wraps an underlying Subscriber into an implementation that caches all events until the call to connect() happens. After being connected, the buffer is drained into the underlying observer, after which all subsequent events are pushed directly.

Companion:
object
trait Subscriber[A]
trait Observer[A]
trait Serializable
class Object
trait Matchable
class Any

Value members

Concrete methods

def connect(): CancelableFuture[Ack]

Connects the underling observer to the upstream publisher.

Connects the underling observer to the upstream publisher.

Until this call happens, the underlying observer will not receive any events. Instead all incoming events are cached. And after connect the cached events will be fed in the underlying subscriber and afterwards we connect the underlying subscriber directly to the upstream source.

This function should be idempotent. Calling it multiple times should have the same effect as calling it once.

The Subscriber.onComplete method that pushes the complete event to the underlying observer.

The Subscriber.onComplete method that pushes the complete event to the underlying observer.

It will wait for connect to happen and the queue of cached events to be drained.

The Subscriber.onError method that pushes an error event to the underlying observer.

The Subscriber.onError method that pushes an error event to the underlying observer.

It will wait for connect to happen and the queue of cached events to be drained.

def onNext(elem: A): Future[Ack]

The Subscriber.onNext method that pushes events to the underlying subscriber.

The Subscriber.onNext method that pushes events to the underlying subscriber.

It will back-pressure by means of its Future[Ack] result until connect happens and the underlying queue of cached events have been drained.

Implicits

Implicits

implicit val scheduler: Scheduler