Skip to content

This project demonstrates the usage of RabbitMQ to process jobs using debouncing. When multiple messages with the same payload are invoked within a specified delay period, only the last message is processed.

Notifications You must be signed in to change notification settings

ChrisTTian667/rabbitmq-debounce-spike

Repository files navigation

Debounce

This project demonstrates the usage of RabbitMQ to process jobs using debouncing. When multiple messages with the same payload are invoked within a specified delay period, only the last message is processed.

Features

  • Queue Jobs: Queue jobs by sending a POST request to the API's endpoint /queue-job with the message payload and a delay in milliseconds.
  • Debouncing: Ensures that only the last message with the same payload is processed within the delay period.
  • RabbitMQ Plugins: Utilizes the rabbitmq_delayed_message_exchange, rabbitmq_message_deduplication, and rabbitmq_shovel plugins.

Invoke a Message

curl --request POST \
--url 'http://localhost:5000/queue-job?message=HelloWorld\&delay=3000'

Getting Started

Prerequisites

  1. Docker
  2. Docker Compose
  3. .NET SDK

Installation

  1. Start RabbitMQ:

    docker-compose up
  2. Run the Project:

    dotnet run --project src/Debounce.Api/Debounce.Api.csproj
  3. Invoke a Message: Use the curl command provided above to test the API.

RabbitMQ Plugins

This project uses the following RabbitMQ plugins to achieve the desired functionality:

  1. rabbitmq_delayed_message_exchange
  2. rabbitmq_message_deduplication
  3. rabbitmq_shovel

These plugins are automatically installed and configured by the Docker setup provided in this project.

Build Instructions

Build the project using Cake.

  1. Restore Local Tools:

    dotnet tool restore
  2. Run Cake:

    dotnet cake

Contributing

Contributions are welcome! Please open an issue or submit a pull request for any changes or improvements.

License

This project is licensed under the MIT License. See the LICENSE file for details.

About

This project demonstrates the usage of RabbitMQ to process jobs using debouncing. When multiple messages with the same payload are invoked within a specified delay period, only the last message is processed.

Topics

Resources

Stars

Watchers

Forks