View Source Bonny.Server.AsyncStreamRunner (bonny v1.2.0)
Runs the given stream in a separate process. Prepare your stream and add this Runner to your supervision tree in order to control it (e.g. restart after the stream ends).
example
Example
# prepare a stream
stream =
conn
|> K8s.Client.stream(operation)
|> Stream.filter(&filter_resources/1)
|> Stream.map(&process_stream/1)
children = [
{Bonny.Server.AsyncStreamRunner,
name: ReconcileServer,
stream: stream,
termination_delay: 30_000,
]
Supervisor.init(children, strategy: :one_for_one)
options
Options
:stream
- The (prepared) stream to run:name
(optional) - Register this process under the given name.:termination_delay
(optional) - After the stream ends, how many milliseconds to wait before the process terminates (and might be restarted by the Supervisor). Per default there's no delay
Link to this section Summary
Link to this section Functions
@spec child_spec(keyword()) :: Supervisor.child_spec()
@spec run(Enumerable.t(), non_neg_integer()) :: no_return()