option to disable inner _messages queue
I am well aware of that this repo is about maintaining the data flows.
However in the edge environment, where the broker may not be accessible and robust as cloud environment, accumulating data at client side would consume all the memory and cause the system to break.
I wish there is some strategies can be added to limit the memory usage.
That's an interesting idea. You could do this by supplying some function that evicts old messages from _messages when it gets too full?
I have already made a work around in my project to pre-check _message content size, and shift it if oversize, before publish new data into the channel.
_.sumBy(channelWrapper._messages, 'content.length')
We would need to completely disable the memory queuing and instead fail fast. We want our clients to stop sending requests as soon as rabbitMq is down. Do you plan to add this feature?
If you have a PR that adds it in a clean way, I'd certainly merge it.
You're right, I should add something to the community too. I will see if it's absolutely necessary. :D @jwalton
I'm running into issues with the internal queue too, since it has issues handling high throughput and is always running behind causing the memory to fill up untill the app crashes. It would be a better idea only to use the internal _messages queue when the connections fails.
You can send messages directly by accessing _channel like this for example:
channelWrapper._channel.sendToQueue(jobName(), new Buffer(EJSON.stringify(task)), options, (err) => {
if (err) {
channelWrapper.close()
connection.close()
}
})