gdaws / stompit

STOMP client library for node.js
MIT License
163 stars 36 forks source link

Setting AMQ_SCHEDULED_DELAY doesn't work #128

Open paul-uz opened 2 years ago

paul-uz commented 2 years ago

I'm setting AMQ_SCHEDULED_DELAY in the send headers, setting it to 10 seconds, and schedulerSupport is set to true in the ActiveMQ config.

However, when I send a message to the queue, it is consumed immediately.

I even tried using the Send tool in ActiveMQ dashboard with the delay set, and that also got sent immediately.

My code to send messages:

stompit.connect({
      host: `${process.env.MQ_ID}-1.mq.eu-west-1.amazonaws.com`,
      port: 61614,
      ssl: true,
      connectHeaders: {
        'login': 'xxx',
        'passcode': 'yyy',
      },
    }, (err, client) => {
      let frame = client.send({ destination: 'TestQueue', AMQ_SCHEDULED_DELAY: 20000 });

      frame.write(JSON.stringify({foo: {bar: 'baz'}, bar: ['foo', 'bar', 'baz']}));

      frame.end();

      client.disconnect();
    });
  };