stompjs
stompjs copied to clipboard
STOMP redelivery policy on SUBSCRIBE doesn't work
Hello, trying to implement redelivery policy on SUBSCRIBE and have no luck.
Is there any way to reach that?
Example:
const { WebSocket } = require('ws');
const { Client } = require('@stomp/stompjs');
Object.assign(global, { WebSocket });
const client = new Client({
brokerURL: 'ws://0.0.0.0:61624',
reconnectDelay: 5000,
heartbeatIncoming: 4000,
heartbeatOutgoing: 4000,
onConnect: () => {
client.publish({
destination: '/queue/Test.Queue',
body: JSON.stringify({ field1: 'value1', field2: 'value2' }),
headers: { 'correlation-id': '6666fe222570b857770849fe', persistent: 'true' },
skipContentLengthHeader: true,
});
client.subscribe(
'/queue/Test.Queue',
message => {
console.log('tick');
message.nack();
},
{
ack: 'client-individual',
'activemq.maximumRedeliveries': '5',
'activemq.redeliveryDelay': '1000',
'activemq.useExponentialBackOff': 'true',
'activemq.backOffMultiplier': '2',
'activemq.initialRedeliveryDelay': '500',
'activemq.maximumRedeliveryDelay': '60000',
},
);
},
});
client.activate();