| SourceUnfoldResourceAsyncT, TSource Method |
Start a new
SourceTOut, TMat from some resource which can be opened, read and closed.
It's similar to
UnfoldResourceT, TSource(FuncTSource, FuncTSource, OptionT, ActionTSource) but takes functions that return
Tasks instead of plain values.
You can use the supervision strategy to handle exceptions for
read function or failures of produced
Tasks.
All exceptions thrown by
create or
close as well as fails of returned futures will fail the stream.
Restart supervision strategy will close and create resource .Default strategy is
Stop which means
that stream will be terminated on error in
read function (or task) by default.
You can configure the default dispatcher for this Source by changing the `akka.stream.blocking-io-dispatcher` or
set it for a given Source by using
CreateDispatcher(String).
Namespace:
Akka.Streams.Dsl
Assembly:
Akka.Streams (in Akka.Streams.dll) Version: 1.2.3.129 (1.2.3.129)
Syntax public static Source<T, NotUsed> UnfoldResourceAsync<T, TSource>(
Func<Task<TSource>> create,
Func<TSource, Task<Option<T>>> read,
Func<TSource, Task> close
)
static member UnfoldResourceAsync :
create : Func<Task<'TSource>> *
read : Func<'TSource, Task<Option<'T>>> *
close : Func<'TSource, Task> -> Source<'T, NotUsed>
Parameters
- create
- Type: SystemFuncTaskTSource
function that is called on stream start and creates/opens resource. - read
- Type: SystemFuncTSource, TaskOptionT
function that reads data from opened resource. It is called each time backpressure signal
is received. Stream calls close and completes when Task from read function returns None. - close
- Type: SystemFuncTSource, Task
function that closes resource
Type Parameters
- T
- TBD
- TSource
- TBD
Return Value
Type:
SourceT,
NotUsedTBD
See Also