This repository serves as a playground for testing various features of MassTransit, an open-source framework for message-based distributed applications.
Explore MassTransit here.
This project consists of two main services:
- MassTransit.Playground.Sender.Api: Exposes various methods to send messages to a bus using MassTransit.
- MassTransit.Playground.Receiver.Api: Does not expose any APIs; it simply consumes messages from a service bus.
The project demonstrates switching between Azure Service Bus and RabbitMQ using MassTransit. To switch the service bus provider, modify the ServiceBusOptions
property in the appsettings.json
file:
"ServiceBusOptions": {
"Type": "AzureBus",
"ConnectionString": ""
}
A Docker Compose file is available in the docker
folder to set up RabbitMQ.
This project covers several key topics related to MassTransit:
- Publishing a message
- Publishing a message with a delay
- Publishing a batch of messages
- Receiving a message
- Receiving the same message on different subscribers
- Receiving messages in batches
- Using observers to intercept published and subscribed events
- Implementing simple retry strategies for message errors