RMQ Consumer (JavaScript)
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_
const amqp = require('amqplib/callback_api');
const connectionParams = {
hostname: 'HostName',
port: 5672,
username: '<Username>',
password: '<Password>',
vhost: 'VHost'
};
const queue = '_<PackageID>_';
amqp.connect(connectionParams, function(error0, connection) {
if (error0) {
throw error0;
}
connection.createChannel(function(error1, channel) {
if (error1) {
throw error1;
}
console.log("Waiting for messages in queue:", queue);
channel.consume(queue, function(msg) {
console.log("Received message:", msg.content.toString());
}, {
noAck: true
});
});
});
Last updated
Was this helpful?