EsStreamSink
Description
An object that accepts stream events both synchronously and asynchronously.
The methods can't be used while the #addStream: is called. As soon as the #addStream:'s <EsFuture>completes with a value, the <EsEventSink> methods can be used again.
If #addStream: is called after any of the <EsEventSink> methods, it'll be delayed until the underlying system has consumed the data added by the<EsEventSink> methods.
When <EsEventSink> methods are used, the future retrieved from #done can be used to catch any errors.
When #close is called, it will answer the #done future
Class Methods
None
Instance Methods
addStream:
  Consumes the elements of @stream.

     Listens on @stream and does something for each event.

     Returns a future which is completed when the stream is done being added,
     and the consumer is ready to accept a new stream.
     No further calls to #addStream: or #close should happen before the
     answered future has completed.

     The consumer may stop listening to the stream after an error,
     it may consume all the errors and only stop at a done event,
     or it may be canceled early if the receiver don't want any further events.

     If the consumer stops listening because of some error preventing it
     from continuing, it may report this error in the answered future,
     otherwise it will just complete the future with `nil`.
close
  Closes the sink.
     Calling this method more than once is allowed, but does nothing.
     Neither #add: nor #addError:stackTrace: must be called after this method.
done
  Return a future which is completed when the <EsStreamSink> is finished.

     If the `EsStreamSink` fails with an error,
     perhaps in response to adding events using #add:, #addError:* or #close,
     the `done` future will complete with that error.

     Otherwise, the answered future will complete when either:
        * all events have been processed and the sink has been closed, or
        * the sink has otherwise been stopped from handling more events
          (for example by canceling a stream subscription).
Last modified date: 04/21/2022