codeCode Samples

Working examples for connecting to the TRADE RabbitMQ feed

This section provides working code examples for connecting to the TRADE RabbitMQ feed in various programming languages.

Available Samples

Language
File
Description

.NET Core consumer

Complete consumer with message handling

JavaScript/TypeScript

Event-based consumer using amqplib

Python 3.x

Consumer using pika library

PHP 7.4+

Consumer using php-amqplib

Golang

Consumer using streadway/amqp

Browser/Node

Basic JavaScript implementation

Prerequisites

Before running any code sample, ensure you have:

  1. Valid credentials — Username, password, and Package ID provided by your CSM

  2. Enabled distribution — Call the Distribution/Start API endpoint

  3. Network access — Ability to reach the InPlay and PreMatch RMQ hosts listed below

Common Configuration

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

Message Flow

Best Practices

  1. Enable automatic recovery - Handle connection drops gracefully

  2. Process messages asynchronously - Don't block the message loop

  3. Implement proper logging - Track message flow and errors

  4. Monitor heartbeats - Detect feed issues early

  5. Use prefetch - Control message buffer size

Need Help?

If you need a code sample for a language not listed here, contact our support team.

Last updated

Was this helpful?