This project demonstrates the usage of Redis Streams in an ASP.NET Core 9 application. It simulates the process of generating 1 million fake account records and streaming them through Redis, where they are processed by consumers.
-
AccountController:
- Exposes an endpoint (
POST /accounts/create-1-million) to generate 1 million fake account records and push them to Redis Stream using a producer.
- Exposes an endpoint (
-
Producer:
AccountCreateProducer: Responsible for adding account records to Redis Stream.BaseProducer: A generic base class for producing messages to a Redis Stream.
-
Consumer:
AccountCreateConsumer: Reads messages from the Redis Stream and processes them.BaseConsumer: A generic base class for consuming messages from a Redis Stream with support for message acknowledgment and batch processing.
-
Redis Integration:
- Redis is used for the stream-based messaging system where data is pushed by the producer and processed by the consumer.
- Producer: Generates data and pushes it to a Redis Stream.
- Consumer: Reads and processes the data from the Redis Stream.
- Redis Stream: A message queue used to handle large volumes of data asynchronously.
-
Account Generation:
- When the
POST /accounts/create-1-millionendpoint is hit, the controller generates 1 million fake account records using the Bogus library.
- When the
-
Data Streaming:
- These records are serialized and pushed to a Redis Stream using the
AccountCreateProducer.
- These records are serialized and pushed to a Redis Stream using the
-
Data Consumption:
- The
AccountCreateConsumercontinuously listens for new records in the Redis Stream and processes them asynchronously.
- The