purposeindustries / node-amqp-schedule

MIT License
6 stars 3 forks source link

I have problem with max channel per tcp connection #2

Open xjewer opened 9 years ago

xjewer commented 9 years ago

This approach unuseful because after creating new delayed queue amqp increase sequence number and this will reach limit (65535 channel). There are no other way to get rid of such behavior unless close your connection.

http://stackoverflow.com/questions/23864647/how-to-avoid-max-channels-per-tcp-connection-with-amqp-php-persistent-connectio

oroce commented 9 years ago

Have you hit the limit in nodejs?

xjewer commented 9 years ago

Yeah, of course. Declare queue create new channel, so when i tried to send few thousands delayed messages, tcp connection reach max channel number

madbence commented 9 years ago

I'm not sure if I can follow, TCP has no channels. I'm not really familiar with amqp internals, but i guess it maintains it's own channels. SInce amqp doesn't expose API for amqp channels, fixing this is problematic. As a workaround I suggest using a separate connection for scheduling messages, and reconnecting every few minutes.

madbence commented 9 years ago

Another workaround is the round param in the options, it defaults to 1000 so scheduling precision 1s by default, if you set it higher, like 60000, it will create less channels (albeit precision will be lower).

var scheduler = require('ampq-schedule');
var delayedPublish = scheduler(conn, {
  round: 60000,
});