# RabbitMQ

MassTransit uses the RabbitMQ delayed exchange (opens new window) plug-in to schedule messages.

RabbitMQ Docker Image

MassTransit provides a Docker Image (opens new window) with RabbitMQ ready to run, including the delayed exchange plug-in.

# Configuration

To configure the delayed exchange message scheduler, see the example below.

namespace SchedulingRabbitMq;

using MassTransit;
using Microsoft.Extensions.DependencyInjection;

public class Program
{
    public static void Main()
    {
        var services = new ServiceCollection();

        services.AddMassTransit(x =>
        {
            x.AddDelayedMessageScheduler();

            x.UsingRabbitMq((context, cfg) =>
            {
                cfg.UseDelayedMessageScheduler();

                cfg.ConfigureEndpoints(context);
            });
        });
    }
}

WARNING

Scheduled messages cannot be canceled when using the delayed exchange message scheduler.