Interface IAsyncCallback<T>
Asynchronous callback holder that is attached to a GraphStageLogic.
Initializing Invoke(T) will eventually lead to the registered callback function being called.
This holder has the same lifecycle as a stream and cannot be used before materialization is done.
Namespace: Akka.Streams.Stage
Assembly: Akka.Streams.dll
Syntax
public interface IAsyncCallback<in T>
Type Parameters
Name | Description |
---|---|
T | The input type accepted by the stage. |
Remarks
Typical use cases for this are exchanging messages between stream and substreams or sending external events to a stream.
Methods
| Edit this page View SourceInvoke(T)
Dispatch an asynchronous notification. This method is thread-safe and may be invoked from external execution contexts.
Declaration
void Invoke(T input)
Parameters
Type | Name | Description |
---|---|---|
T | input |
Remarks
For cases where it's important to know if the notification was ever processed or not, please see InvokeWithFeedback(T)
InvokeWithFeedback(T)
Dispatch an asynchronous notification. This method is thread-safe and may be invoked from external execution contexts.
This method returns directly and the returned Task is then completed once the event has been handled by the operator. If the event triggers an exception from the handler the returned Task will be completed with that exception.
If the operator was stopped before the event was handled then the Task will fail with a StreamDetachedException.
Declaration
Task<Done> InvokeWithFeedback(T input)
Parameters
Type | Name | Description |
---|---|---|
T | input |
Returns
Type | Description |
---|---|
Task<Done> |
Remarks
The handling of the returned Task incurs slight overhead, so in cases where you don't need an explicit reply please use Invoke(T) instead.