﻿# Simple RabbitMQ Transport Usage



## Prerequisites

Ensure an instance of RabbitMQ is running and accessible.


## Code walk-through

This sample shows basic usage of RabbitMQ as a transport for NServiceBus to connect two endpoints. The sender sends a command or publishes an event to a receiver endpoint using the RabbitMQ broker. The receiver writes to the console when the message is received.


### Configuration

<!-- snippet: ConfigureRabbit -->

```cs
var endpointConfiguration = new EndpointConfiguration("Samples.RabbitMQ.SimpleSender");
var transport = endpointConfiguration.UseTransport<RabbitMQTransport>();
transport.UseConventionalRoutingTopology(QueueType.Quorum);
transport.ConnectionString("host=localhost");
```

<!-- endsnippet -->

The username and password can be configured in the connection string. If these are not present, the connection string defaults to `host=localhost;username=guest;password=guest`.
