# RabbitMQ Connection

This section covers everything you need to establish and maintain a connection to the TRADE data feed via RabbitMQ.

## Overview

TRADE uses RabbitMQ to deliver real-time sports data. The connection process involves:

1. **Enabling your distribution** - Activating your data package
2. **Establishing connection** - Connecting to the RabbitMQ server
3. **Consuming messages** - Processing incoming data messages
4. **Handling message types** - Understanding and processing different message formats

## Topics in This Section

* [Connection & Consumption Setup](https://docs.lsports.eu/u/trade/integration/rmq-connection/connection-and-consumption-setup) - Step-by-step guide to connect to RabbitMQ
* [Message Deserializing](https://docs.lsports.eu/u/trade/integration/rmq-connection/message-deserializing) - How to decode and parse incoming messages
* [Market/Bet Message Handling](https://docs.lsports.eu/u/trade/integration/rmq-connection/market-bet-message-handling) - Processing market and bet data
* [Working with TRADE Feed](https://docs.lsports.eu/u/trade/integration/rmq-connection/how-to-work-with-trade-feed) - Best practices for feed consumption

## Header-Based Routing

Every RabbitMQ message includes metadata headers you can read **before** deserializing the payload. This includes `MessageType`, `FixtureId`, and `SportId` — so you can route or filter messages by sport at the consumer level without touching the message body. See [RabbitMQ Header](https://docs.lsports.eu/u/trade/integration/message-structure/rabbitmq-header) for the full list.

## Connection Details

Connect using the username and password provided by your CSM. The host and virtual host depend on the feed type:

| Parameter        | InPlay                  | PreMatch                  |
| ---------------- | ----------------------- | ------------------------- |
| **Host**         | `stm-inplay.lsports.eu` | `stm-prematch.lsports.eu` |
| **Virtual Host** | `StmInPlay`             | `StmPreMatch`             |

| Parameter    | Value                                 |
| ------------ | ------------------------------------- |
| **Port**     | `5672`                                |
| **Queue**    | `_YOUR_PACKAGE_ID_` (e.g. `_102030_`) |
| **Protocol** | AMQP 0.9.1                            |

Contact your Customer Success Manager (CSM) to obtain your credentials.
