Open xjewer opened 9 years ago
Have you hit the limit in nodejs?
Yeah, of course. Declare queue create new channel, so when i tried to send few thousands delayed messages, tcp connection reach max channel number
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.
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,
});
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