gdaws / stompit

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

Message gets redelivered in loop during the time of high CPU processing on the client side #123

Open coder5492 opened 3 years ago

coder5492 commented 3 years ago

This is the flow of the issue

In all of these cases I am receiving high amounts of connect time out error. During low or average CPU loads on the nodejs server, everthing seems to work fine. Issue is only when the load is high

This is the code for connection

const stompit = require('stompit')
const keys = require('./keys')
const logger = require('../utils/logger.util')
const reconnectOptions = {
  useExponentialBackOff: true
}
let ssl = !!parseInt(keys.activeMQ.ssl)
const serverPrimary = {
  host: keys.activeMQ.host,
  port: keys.activeMQ.port,
  ssl: ssl,
  connectHeaders: {
    host: '/',
    login: keys.activeMQ.username,
    passcode: keys.activeMQ.password,
    'heart-beat': '5000,5000',
  },
}

const serverFailover = {
  host: keys.activeMQ.host1,
  port: keys.activeMQ.port,
  ssl: ssl,

  connectHeaders: {
    host: '/',
    login: keys.activeMQ.username,
    passcode: keys.activeMQ.password,
    'heart-beat': '5000,5000',
  },
}
connManager = new stompit.ConnectFailover(
  [serverPrimary, serverFailover],
  reconnectOptions,
)

connManager.on('error', function (e) {
  const connectArgs = e.connectArgs
  const address = connectArgs.host + ':' + connectArgs.port
  logger.error({ error: e, customMessage: address })
})

channelPool = new stompit.ChannelPool(connManager)
module.exports = channelPool

@gdaws Could you please help me out on this. I have been stuck on this for weeks

Main issues being

medchkir commented 2 years ago

Hi, I have the same problem. I reproduced with a timeout after 20s (> heartbeat).

medchkir commented 2 years ago

Hello, i tried to migrate to activemq artemis version and it seems to work fine

hanseld28 commented 2 years ago

I have the exact same problem with the classic and artemis version. Is this problem related to STOMP protocol, stompit library, Node.js or the broker?