Skip to content

leroyguillaume/stream-consumer-task

Repository files navigation

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.

About

Start asynchronous task in background to consume stream.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages