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

# RabbitMQ

> Connect to your internal microservices via a message queue

## Overview

Hightouch integrates with RabbitMQ so you can send data from your warehouse as messages to a RabbitMQ broker without writing and maintaining code, letting you build a custom connector to your internal systems.

Hightouch supports all managed RabbitMQ brokers (Amazon MQ, CloudAMQP, etc.) and can also connect to self-hosted instances.

## Connect to RabbitMQ

### Connect to your RabbitMQ server

For Hightouch to connect to your RabbitMQ server, you need to enter the connection parameters of your [RabbitMQ URI](https://www.rabbitmq.com/uri-spec.html). These parameters include the **protocol** used, server connection details (**host address** and **port**), authentication credentials (**username** and **password**) and **vhost**.
You also need to enter your [Management Portal URL](https://www.rabbitmq.com/management.html) for Hightouch to query the queues in your RabbitMQ server,.

* **Protocol**: Select the protocol used for your RabbitMQ server. This is either `amqp` or `amqps`.
* **Host**: Enter your host address to establish the underlying TCP/IP connection to the server.
* **Port**: Enter your port number to establish the underlying TCP/IP connection to the server.
* **VHost**: Enter you vhost. The default value is `/`.
* **Management Portal**: Enter your management portal URL. This can usually be found on the details page for your hosted RabbitMQ solution.
* **Username and Password**: Enter your RabbitMQ server username and password.

## Syncing data

Once you've connected your RabbitMQ server to Hightouch, you can configure a sync that send messages whenever rows are added, changed, or removed in your model.

### Configure your events trigger

Hightouch monitors your data model for added, changed, and removed rows. In this step, you specify which of these events should trigger message publishing.

![Events to trigger message publishing](https://mintcdn.com/hightouch-3c037897/L_vQfA0JQEpeGUUo/images/destinations/destination-apache-kafka-events-trigger.png?fit=max\&auto=format\&n=L_vQfA0JQEpeGUUo\&q=85\&s=28854166e227ae9a2b4a5ef059e2c5e1)

### Choose your queue

In this step, you choose which queues to publish the messages to. Hightouch allows you to sync to existing queues that are already in your RabbitMQ.

Suppose you want to sync to multiple existing queues but don't want to create a new sync for every queue. As long as your model has a column associated to queue names in your RabbitMQ server, Hightouch can sync to multiple RabbitMQ queues in just one sync.
To enable this feature, toggle **USE COLUMN**, and select a column in your model containing the queue name rows.

![Toggle use column to send message to multiple queues](https://mintcdn.com/hightouch-3c037897/L_vQfA0JQEpeGUUo/images/destinations/destination-message-queue-choose-queue.png?fit=max\&auto=format\&n=L_vQfA0JQEpeGUUo\&q=85\&s=90ca9ae65f28fd18316cb7c5eeac77f4)

> [!NOTE]
>
> When syncing to multiple queues, if a queue name in the selected column of
> your model doesn't exist in RabbitMQ, then the sync for that message will
> fail.

### Customize your message

![Customize message data options](https://mintcdn.com/hightouch-3c037897/L_vQfA0JQEpeGUUo/images/destinations/destination-apache-kafka-customize-message-data.png?fit=max\&auto=format\&n=L_vQfA0JQEpeGUUo\&q=85\&s=0c1b4ab9a4c632c12b92dd202d69638a)

In this step, you tell Hightouch how to build the JSON message data object using data from your model.

This destination offers three methods of composing a JSON object:

* [Using a JSON editor](#use-json-editor)
* [Using one column from a model](#use-one-column-from-model)
* [Using multiple columns from a model](#use-multiple-columns-from-model)

#### Use JSON editor

![Selecting the JSON editor method in the Hightouch UI](https://mintcdn.com/hightouch-3c037897/L_vQfA0JQEpeGUUo/images/destinations/destination-apache-kafka-json-editor.png?fit=max\&auto=format\&n=L_vQfA0JQEpeGUUo\&q=85\&s=6830e78d7d8182901468cda59e8a7d2f)

With the JSON editor, you can compose any JSON object using the [Liquid template language](https://shopify.github.io/liquid/). This is particularly useful for complex message data bodies containing nested objects and arrays, which can sometimes be difficult to model entirely in SQL.

Suppose your data model looks like this:

| full\_name | age | email\_address | phone\_number |
| - | - | - | - |
| John Doe | 30 | `john@example.com` | +14158675309 |

And you want your message data like this:

```json theme={null}
{
  "name": "John Doe",
  "age": 30,
  "contact_info": [
    {
      "type": "email",
      "value": "john@example.com"
    },
    {
      "type": "phone",
      "value": "+14158675309"
    }
  ]
}
```

Your Liquid template should look like this:

```txt theme={null}
{
  "name": "{{row.full_name}}",
  "age": {{row.age}},
  "contact_info": [
    {
      "type": "email",
      "value": "{{row.email_address}}"
    },
    {
      "type": "phone",
      "value": "{{row.phone_number}}"
    }
  ]
}
```

This makes it so you can reference any column using the syntax `{{row.column_name}}`. You can also use advanced Liquid features to incorporate control flow and loops into your dynamic message data.

> [!NOTE]
>
> When injecting strings into your JSON object, be sure to surround the Liquid
> tag in double quotes.

#### Use one column from model

![Selecting using one column from the model as the JSON construction method in the Hightouch UI](https://mintcdn.com/hightouch-3c037897/L_vQfA0JQEpeGUUo/images/destinations/destination-apache-kafka-one-column-from-model.png?fit=max\&auto=format\&n=L_vQfA0JQEpeGUUo\&q=85\&s=c66e2810e7ecfc25e2b2850a2dc23d25)

If you're already storing JSON data in your source, or if you have the ability to construct a JSON object using SQL, you can select one column in your model that already contains the full message data.

This setting is commonly used when syncing web events that have already been collected and stored as JSON objects in your database.

#### Use multiple columns from model

![Selecting using multiple columns from the model as the JSON construction method in the Hightouch UI](https://mintcdn.com/hightouch-3c037897/L_vQfA0JQEpeGUUo/images/destinations/destination-apache-kafka-multiple-columns-from-model.png?fit=max\&auto=format\&n=L_vQfA0JQEpeGUUo\&q=85\&s=382ba61008ce45c38571d0baab75e043)

For the simplest use cases, Hightouch can construct a JSON object with key/value pairs based on multiple columns in your model.

Suppose your model looks like this:

| email | first\_name | last\_name |
| - | - | - |
| `alice.doe@example.com` | Alice | Doe |
| `bob.doe@example.com` | Bob | Doe |
| `carol.doe@example.com` | Carol | Doe |

The field mapping in the screenshot above would generate the following message data for the first row:

```json theme={null}
{
  "customer_first_name": "Alice",
  "customer_last_name": "Doe",
  "customer_email": "alice.doe@example.com"
}
```

> [!TIP]
>
> You can use the field mapper to rename fields. For example, `first_name` can
> be mapped to `customer_first_name`.

### Configure initial sync behavior

In this step, you tell Hightouch how to handle rows present in your model results during the first sync run.

Certain workflows may require performing a backfill of all rows during the initial sync. For other use cases, you might only want to send messages in response to future data changes.

![Declaring how to handle initial sync behavior in Hightouch](https://mintcdn.com/hightouch-3c037897/L_vQfA0JQEpeGUUo/images/destinations/destination-apache-kafka-initial-sync-behaviour.png?fit=max\&auto=format\&n=L_vQfA0JQEpeGUUo\&q=85\&s=4a41e51ef0ff4e7c1152c87b50407a79)

## Tips and troubleshooting

To see the exact API requests and responses from each sync run, use the [live debugger](https://docs.hightouch.com/syncs/debugger.md). To get notified by Slack, PagerDuty, SMS, or email when a sync fails, set up [sync alerts](https://docs.hightouch.com/syncs/alerting.md). If you run into an issue this page doesn't cover, [contact support](#pylon-chat).
