#task #stream #consumer #async

stream-consumer-task

Start asynchronous task in background to consume stream

1 unstable release

0.1.0 Jan 21, 2024

#1875 in Asynchronous

Download history 3/week @ 2024-02-15 9/week @ 2024-02-22 3/week @ 2024-02-29 3/week @ 2024-03-21 63/week @ 2024-03-28 1/week @ 2024-04-04

64 downloads per month

MIT license

18KB
131 lines

stream-consumer-task

Start asynchronous task in background to consume stream.

It can be useful if your application consumes several RabbitMQ queues or Kafka Topics.

Getting started

Add to your Cargo.toml:

[dependencies]
...
stream-consumer-task = "0"
...

You can look examples to see how to use the library.

Architecture

The task takes two arguments: a stream and an item handler.

Each time a new item is available in the stream, the consumer spawns a new task to handle it.

The item handler takes two arguments: the item from the stream and a Receiver<()> to handle graceful shutdown.

If the consumer is stopped, a stop signal is sent to all tasks and it will wait them termination.

Contributing

See CONTRIBUTING.md.

Dependencies

~3–6.5MB
~109K SLoC