简体   繁体   English

过了一会儿我得到了这个错误:错误:没有剩余的频道可以分配

[英]after a while i got this error : Error: No channels left to allocate

i want to send and save some data in the rabbit;我想在兔子中发送和保存一些数据; after a while that i run my code and after some sending data into my rabbit i get some error like this: Error: No channels left to allocate过了一会儿,我运行了我的代码,在将一些数据发送到我的兔子之后,我得到了这样的错误:错误:没有剩余的通道可以分配

i use from this code several times because i have several data to send into rabbitMQ我多次使用这段代码,因为我有几个数据要发送到 rabbitMQ

let open = require('amqplib').connect('amqp://localhost:5672')


    open.then(function (conn) {
      return conn.createChannel()
    }).then(function (ch) {
      return ch.assertQueue(q).then(function (ok) {
        ch.sendToQueue(q, Buffer.from(JSON.stringify(data)))
        return ch.close()
      })
    }).catch(console.warn)

Looks like you are creating new channels when you are publishing messages.看起来您在发布消息时正在创建新频道。

I solved the issue in this question我解决了这个问题中的问题

Rabbit MQ amqplib error "No channels left to allocate" Rabbit MQ amqplib 错误“没有要分配的通道”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM