# 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**](http://stm-inplay.lsports.eu) **|** for PreMatch: [**stm-prematch.lsports.eu**](http://stm-prematch.lsports.eu)\
\* \<VirtualHost> = for InPlay: "**StmInPlay**" **|** for PreMatch: "**StmPreMatch**"\
\* \<PackageID> = should be a number between “\_“ for example \_100\_

```javascript
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
    });
  });
});
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.lsports.eu/u/trade/integration/code-samples/rmq-consumer-javascript.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
