# Azure Service Bus

Azure Service Bus allows the enqueue time of a message to be specified, making it possible to schedule messages without the use of a separate message scheduler. MassTransit uses this feature to schedule messages.

# Configuration

To configure the Azure Service Bus message scheduler, see the example below.

namespace SchedulingAzure
{
    using System;
    using MassTransit;
    using MassTransit.Azure.ServiceBus.Core;
    using Microsoft.Extensions.DependencyInjection;

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

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

                x.UsingAzureServiceBus((context, cfg) => 
                {
                    cfg.UseServiceBusMessageScheduler();

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

TIP

Azure Service Bus supports message cancellation, unlike the other transports.