Called on EOF to produce the final result.
Called on EOF to produce the final result.
Equivalent to StreamInput.onComplete. See the README for concurrency issues.
Called to process each successive element in the stream.
Called to process each successive element in the stream.
Equivalent to StreamOutput.onNext. See the README for concurrency issues.
The core abstract method that must be implemented by each instance, providing the function behavior.
The core abstract method that must be implemented by each instance, providing the function behavior.
Shortcut for a cast to AsyncFunc.
Shortcut for a cast to AsyncFunc. Fails at runtime with ClassCastException if this function is synchronous.
Shortcut for a cast to SyncFunc.
Shortcut for a cast to SyncFunc. Fails at runtime with ClassCastException if this function is asynchronous.
Materializes the stream, including all components linked (transitively) to this one, and starts running it.
Materializes the stream, including all components linked (transitively) to this one, and starts running it.
The same result is produced no matter which stream component is used to call build
.
This method may only be called once per stream (see README on the subject of reusing components).
A shortcut method that calls build
and returns the RunningStreamComponent representing this
.
A shortcut method that calls build
and returns the RunningStreamComponent representing this
.
A shortcut method that calls build
and returns the future result produced by this component.
A shortcut method that calls build
and returns the future result produced by this component.
Creates a new function composing these two, which is synchronous iff both inputs were synchronous.
Returns a new function that passes any exceptions in the original function to handler
.
Returns a new function that passes any exceptions in the original function to handler
.
The new function still fails with the original exception after the handler
has run.
The returned Func is synchronous iff the original func is synchronous.
Returns the result future that will eventually be completed when the stream runs.
Returns the result future that will eventually be completed when the stream runs. This is identical to the Future
returned by the RunningStream for this component, which is also returned by buildResult
.
This method is useful when you want to know about the completion and/or the result in a location other than the one where you actually run the stream, such as when you produce a Sink and give it to someone else to use.
Returns true iff this function is either Func.nop
or Func.nopAsync
.
Returns true iff this function is either Func.nop
or Func.nopAsync
.
Returns true iff this is a function built by Func.pass
.
Returns true iff this is a function built by Func.pass
.
Returns true iff this is a SyncFunc
Called on each input element, non-concurrently with itself and onNext.
Called on each input element, non-concurrently with itself and onNext.
Can only be called once, and no more calls to onNext are allowed afterwards.
Called if the stream fails.
Called if the stream fails. Equivalent to StreamInput.onError. See the README for concurrency issues.
Called if the stream fails.
Called if the stream fails. See the README on the semantics of stream failure. This method is guaranteed to be called exactly once.
This is called *concurrently* with onNext and onComplete.
Called on each input element, non-concurrently with itself and onComplete.
Called on each input element, non-concurrently with itself and onComplete.
Adds a synchronous recovery stage to this function, which handles both synchronously thrown exceptions, and failing futures returned by asynchronous functions.
Adds an asynchronous recovery stage to this function, which handles both synchronously thrown exceptions, and failing futures returned by asynchronous functions.
Adds an asynchronous recovery stage to this function, which handles both synchronously thrown exceptions, and failing futures returned by asynchronous functions.
This isn't declared to return an AsyncFunc because it can discard the handler
and return a SyncFunc if the
original function is e.g. nop
or pass
.
Returns either B or a Future[B] depending on the type of this Func.
Adds a recovery stage to this function, which handles both synchronously thrown exceptions, and failing futures returned by asynchronous functions.
Adds a recovery stage to this function, which handles both synchronously thrown exceptions, and failing futures returned by asynchronous functions.
If this
and handler
are both synchronous, then the result will also be synchronous.
Because the handler
is a Func, it cannot be a partial function; it must handle all NonFatal exceptions.
Exceptions that don't match the NonFatal extractor will not be passed to the handler.
Suppress all errors matched by the NonFatal extractor.
Alias for compose
.
Alias for compose
. Creates a new function composing these two, which is synchronous iff both inputs were synchronous.
A trait that allows implementing a custom StreamOutput that processes items asynchronously.
This often allows writing more elegant code for complex stateful consumers.