pub fn task<E, EC, ECR>(
    event_consumer_channel: EC,
    origin_id: StreamId,
    stream_id: StreamId,
    entity_type: EntityType,
    max_in_flight: usize
) -> (impl Future<Output = ()>, GrpcEventFlow<E>, Sender<()>)where
    E: Clone + Name + 'static,
    EC: Fn() -> ECR + Send + Sync,
    ECR: Future<Output = Result<Channel, Error>> + Send,
Expand description

Provides an asynchronous task and a kill switch that can run and stop a reliable stream of event envelopes to a consumer. Event envelope transmission requests are sent over a channel and have a reply that is completed on the remote consumer’s acknowledgement of receipt.

The max_in_flight parameter determines the maximum number of events that we can go unacknowledged at any time. Meeting this threshold will back-pressure the production of events.