---
title: "Connect MassTransit"
description: "Run .NET apps that use MassTransit on a RabbitMQ cluster over AMQPS."
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.ezghcloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Connect MassTransit

MassTransit connects to a RabbitMQ cluster with the cluster's name, a user and TLS. New queues are
quorum queues unless the app declares another type (see
[Vhosts and queues](/hosted-queues/vhosts#default-queue-type)).

```csharp
services.AddMassTransit(x =>
{
    x.AddConsumers(typeof(Program).Assembly);
    x.UsingRabbitMq((context, cfg) =>
    {
        cfg.Host("mq-hylq6kelvuwvn2ks4yqhp4jaqu.us-west-1.ezghcompute.com", 5671, "/", h =>
        {
            h.Username(username);
            h.Password(password);
            h.UseSsl(s =>
            {
                s.ServerName = "mq-hylq6kelvuwvn2ks4yqhp4jaqu.us-west-1.ezghcompute.com";
                s.Protocol = SslProtocols.Tls12 | SslProtocols.Tls13;
            });
        });
        cfg.ConfigureEndpoints(context);
    });
});
```

Read `username` and `password` from the user's [Secret](/hosted-queues/users#passwords-in-secrets).
The cluster's certificate chains to the [EZGH CA bundle](/hosted-queues/connect#tls): add the bundle to
the trusted roots of the image or host the app runs on.

MassTransit needs no setting for quorum queues: its endpoint queues become quorum queues on a vhost
whose default is `quorum`. This is tested with MassTransit.RabbitMQ 8.5 on .NET 10, over AMQPS and
over the [plaintext port](/hosted-queues/connect#the-plaintext-port).

MassTransit reconnects by itself when a connection closes. See
[Timeouts and reconnects](/hosted-queues/timeouts-and-reconnects).

Source: https://docs.ezghcloud.com/hosted-queues/connect-masstransit/index.mdx
