gdaws/stompit

The connection is closing when thousands of messages are ready to subscribe in queue

iravinandan opened this issue · 1 comments

Error Message received:AMQ229014: Did not receive data from /10.xxxx.xx.xx:50740 within the 2,000ms connection TTL. The connection will now be closed.

Pretty much using similar code of example shown for channel for process all the message at a time:

`var stompit = require('stompit');

export const getMessages = async () => {
// Configure connection management

  var servers = [
    { 
      host: 'localhost',
      port: 61613,
      connectHeaders:{
        'host': 'localhost',
        'login': 'admin',
        'passcode': 'password',
        'heart-beat': '1000:1000'
      }
    }
  ];
  
  var reconnectOptions = {
    maxReconnects: 10
  };
  
  
  
  var connections = new stompit.ConnectFailover(servers, reconnectOptions);
  
  // Log connection events
  
 await connections.on('connecting', function(connector) {
    
    var address = connector.serverProperties.remoteAddress.transportPath;
    
    console.log('Connecting to ' + address);
  });
  
 await connections.on('error', function(error) {
    
    var connectArgs = error.connectArgs;
    var address = connectArgs.host + ':' + connectArgs.port;
    
    console.log('Connection error to ' + address + ': ' + error.message);
  });
  
  // Create channel, subscribe to a queue, and consume one message
  
  var channelFactory = new stompit.ChannelFactory(connections);
  
  
  await channelFactory.channel(async function(error, channel) {
    
    if (error) {
      console.log('channel factory error: ' + error.message);
      return;
    }
    
    var headers = {
      'destination': '/queue/test',
      'ack': 'client-individual'
    };
  
    await channel.subscribe(headers, async function(error, message, subscription){
      
      if (error) {
        console.log('subscribe error: ' + error.message);
        return;
      }
      
      await message.readString('utf8', async  function(error, string) {
            
        if (error) {
          console.log('read message error: ' + error.message);
          return;
        }
        
        console.log('receive message: ' + string);
  
        channel.ack(message);
        
      });
    });
  });

}`

get message()

This issue was due to JMS Server. After patch on JMS Server started noticing this warning disappeared.