gdaws / stompit

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

A NACK call incorrectly results in an ACK on the server side #135

Open Tofuburger opened 5 months ago

Tofuburger commented 5 months ago

I would use the pool channel and unfortunately, I cannot send a nack to the server. On the contrary, the sent NACK becomes an ACK on the server. The client-side ACK logic works.

const req = {
  headers: {
    ack: 12345
    'message-id': 12345,
    subscription: 1
  }
};

An ACK call results in an ACK on the server. > Success

async _ack(channel, req) {
  return new Promise((resolve) => {
    channel.ack(req, undefined, undefined, (err) => {
      err
        ? reject(err)
        : resolve(req);
    });
  });
}

A NACK call incorrectly results in an ACK on the server. > Wrong Success

async _nack(channel, req) {
  return new Promise((resolve) => {
    channel.nack(req, undefined, undefined, (err) => {
      err
        ? reject(err)
        : resolve(req);
    });
  });
}