Getting Started

Common information that you need to get started using our queue based updates.

A more advanced option that provides full control over message consumption. Use this method to pull messages from a queue at your preferred pace.

🔐 Get Your RabbitMQ Credentials

Contact your sales representative to obtain:

  • rabbitmq_username
  • rabbitmq_password

Note that these are assigned on an API Key basis, so if you have multiple API Keys, they will each have different credentials.

🛠️ Connect to RabbitMQ

Use the credentials and queue_name to connect via any RabbitMQ client.

ParameterValue
Hostv3-rmq.opticodds.com
Port5672
Virtual Hostapi
UsernameFrom your sales rep
PasswordFrom your sales rep
Queue NameFrom your respective /start response

🔍 Example: Python Consumer

import pika  # pip install pika

# Use the Full URL
# connection = pika.BlockingConnection(pika.URLParameters(f"amqp://{<USERNAME>}:{<PASSWORD>}@copilot-rmq.opticodds.com:5672/api"))
# Use the individual params
connection = pika.BlockingConnection(
    pika.ConnectionParameters(
    	host='v3-rmq.opticodds.com',
    	port=5672,
    	virtual_host='api',
    	credentials=pika.PlainCredentials('<USERNAME>', '<PASSWORD>')
    )
)

# Callback function that contains the messages.
def callback(ch, method, properties, body):
    print("Received message: %r" % body)

print("Connected to RabbitMQ")
channel = connection.channel()
channel.basic_qos(prefetch_count=100)

# Consume messages
channel.basic_consume(queue=queue, on_message_callback=callback, auto_ack=True)
channel.start_consuming()