RMQ Consumer (Python)
Make sure to adjust the following fields as described on documentation : * <UserName> = username * <Password> = password * <HostName> = for InPlay: stm-inplay.lsports.eu | for PreMatch: stm-prematch.lsports.eu * <VirtualHost> = for InPlay: "StmInPlay" | for PreMatch: "StmPreMatch" * <PackageID> = should be a number between “_“ for example _100_
import pika
connection = pika.BlockingConnection(
pika.ConnectionParameters(
host='HostName',
port=5672,
virtual_host='VHost',
credentials=pika.PlainCredentials('<UserName>', '<Password>')
)
)
channel = connection.channel()
def callback(ch, method, properties, body):
print("Received message: %r" % body)
channel.basic_consume(queue='_<package_id>_', on_message_callback=callback, auto_ack=True)
print("Waiting for messages...")
channel.start_consuming()
Last updated
Was this helpful?