await/async:assertQueue([queue, [options]])
    callback:assertQueue([queue, [options, [function(err, ok) {…}]]])

    • queue:队列名称
    • options:队列参数,可谓空(null)
      • exclusive-[type:bool]-[detail:false]-[info:将队列范围定义为链接]
      • durable-[type:bool]-[detail:false]-[info:定义队列是否持久化,重启之后是否依然存在]
      • autoDelete-[type:bool]-[detail:true]-[info:当队列为空,自动删除队列]
      • messageTtl-[type:num]-[info:n毫秒后,到达队列的消息为过期消息,0<=n<2^32]
      • expires-[type:num]-[info:队列n毫秒后,不被销毁,0<=n<2^32]
      • deadLetterExchange-[type:string]-[info:队列中丢弃的消息,将发送到该交换]
      • deadLetterRoutingKey-???
      • maxLength-[type:num]-[info:最大消息队列,旧消息将被丢弃]
      • maxPriority-[type:num]-[info:这是优先队列]
      • arguments-[info:附加参数,为RabbitMQ插件试用]
        1. // callback
        2. channel.assertQueue(queue,{
        3. exclusive: "[type:bool]-[detail:false]-[info:将队列范围定义为链接]",
        4. durable: "[type:bool]-[detail:false]-[info:定义队列是否持久化,重启之后是否依然存在]",
        5. autoDelete: "[type:bool]-[detail:true]-[info:当队列为空,自动删除队列]",
        6. messageTtl: "[type:num]-[info:n毫秒后,到达队列的消息为过期消息,0<=n<2^32]",
        7. expires: "[type:num]-[info:队列n毫秒后,不被销毁,0<=n<2^32]",
        8. deadLetterExchange: "[type:string]-[info:队列中丢弃的消息,将发送到该交换]",
        9. deadLetterRoutingKey: "???",
        10. maxLength: "[type:num]-[info:最大消息队列,旧消息将被丢弃]",
        11. maxPriority: "[type:num]-[info:这是优先队列]",
        12. arguments: "[info:附加参数,为RabbitMQ插件试用]",
        13. },function(error,ok){
        14. if(error) throw error;
        15. console.log(ok)
        16. })
        ```javascript // await/async try{ const assertQueue = await channel.assertQueue(queue,{ exclusive: “[type:bool]-[detail:false]-[info:将队列范围定义为链接]”, durable: “[type:bool]-[detail:false]-[info:定义队列是否持久化,重启之后是否依然存在]”, autoDelete: “[type:bool]-[detail:true]-[info:当队列为空,自动删除队列]”, messageTtl: “[type:num]-[info:n毫秒后,到达队列的消息为过期消息,0<=n<2^32]”, expires: “[type:num]-[info:队列n毫秒后,不被销毁,0<=n<2^32]”, deadLetterExchange: “[type:string]-[info:队列中丢弃的消息,将发送到该交换]”, deadLetterRoutingKey: “???”, maxLength: “[type:num]-[info:最大消息队列,旧消息将被丢弃]”, maxPriority: “[type:num]-[info:这是优先队列]”, arguments: “[info:附加参数,为RabbitMQ插件试用]”, }; console.log(assertQueue) /**
      • log :
      • {
      • queue: ‘foobar’, 队列名
      • messageCount: 0, 消费者计数
      • consumerCount: 0, 最近的消息计数
      • } */ }catch(e){ console.log(e); } ```