首页 > 其他分享 >RabbitMQ _ How to Close a Channel

RabbitMQ _ How to Close a Channel

时间:2023-04-28 17:22:49浏览次数:41  
标签:RabbitMQ How connection Channel Close close channel

https://low-orbit.net/rabbitmq-how-to-close-a-channel

 

RabbitMQ How to Close a Channel

If you have found your way to this page you are probably wondering how to close a channel in RabbitMQ. Channels should be closed when they are no longer in use. There are multiple different ways of going about doing this that we are going to cover.

To close a RabbitMQ channel do one of the following:

  • Kill the corresponding consumer.
  • Close the channel from within your code: channel.close()
  • Close the associated connection from within your code: connection.close()
  • Use the CLI command: rabbitmqctl close_connection CONNECTION-NAME “my message”
  • Click on the button in the web GUI to close it.

Programmatically Close a RabbitMQ Channel

Option 1: Close Channel

A channel can be programmatically closed like this:

channel.close()

Option 2: Close Connection

All channels on a connection will be closed when you close that connection. You can close a connection programmatically like this:

connection.close()

Using the CLI

You can close a channel from the CLI by closing it’s connection.

To close a channel using the CLI you will first need to find the channel and it’s associated connection. Use the following command to list out channels and connections.

rabbitmqctl list_channels connection

You can close the channel’s connection using the following command. You need to specify the connection which we found previously. The last parameter is a message explaining why the connection is being closed. This will be included in the error message that is output by the consumer.

rabbitmqctl close_connection "<[email protected]
>" "go away"

标签:RabbitMQ,How,connection,Channel,Close,close,channel
From: https://www.cnblogs.com/panpanwelcome/p/17362730.html

相关文章

  • Provisional heads are shown、NullPointerException空指针异常?堆栈与队列的区别?Java
    Provisionalheadsareshown排查是否插件拦截,我的以前没有这种,所以排除本地网络节点问题,连接不到图片服务器,以下是解决方法:1.进入到C盘Windows文件夹System32/drivers/etc目录下,打开hosts文件,绑定下2.改下本地dns为公共dns网络节点导致的问题,一般为运营商导致,产生问题的原因为......
  • Linux安装RabbitMQ
    前言:还是和以前一样,linux安装软件的目录都是data目录 1.这次稍微不一样,不过还是进入data目录,创建RabbitMq目录并进入该目录cd/datamkdirrabbitMqcdrabbitMq 2.上传"erlang-21.1-1.el7.x86_64.rpm"文件和 "rabbitmq-server-3.7.7-1.el7.noarch.rpm"文件到当前......
  • 使用jquery探测移动设备 How to detect mobile devices using jQuery
     Helloeveryone,yesterdayIreceivedarequestfromtheclient.HewantedtodisablethepopupofNewsletterPopupextensionwhencustomersvisithiswebsiteonmobiledevices.ItgavemeachancetoworkwithjQueryagainandfinallyIcameupwitha......
  • jquery:临时禁止鼠标滚动 How to disable scrolling temporarily?
    1.代码://left:37,up:38,right:39,down:40,//spacebar:32,pageup:33,pagedown:34,end:35,home:36varkeys={37:1,38:1,39:1,40:1};functionpreventDefault(e){e=e||window.event;if(e.preventDefault)e.preventDefault()......
  • How to use axios.js instead of request.js to get data as a buffer All In One
    Howtouseaxios.jsinsteadofrequest.jstogetdataasabufferAllInOne如何使用axios.js代替request.js获取数据作为缓冲区questionconstfs=require("fs");varpath=require("path");const{exit}=require("process");//requ......
  • How to get Linux kernel Information using the command line All In One
    HowtogetLinuxkernelInformationusingthecommandlineAllInOne如何使用命令行获取Linux内核信息uname#macOS$uname-aDarwinxgqfrms-mm.local22.2.0DarwinKernelVersion22.2.0:FriNov1102:08:47PST2022;root:xnu-8792.61.2~4/RELEASE_X86_64x......
  • How do I make a delicious lemon cheesecake?
    Therearemanydifferentwaystoprepareadeliciouslemoncheesecake.Hereisonepopularrecipethatyoucantry:Ingredients:21/4cupsgrahamcrackercrumbs(about150crackers)3tablespoonssugar8ozcreamcheese,softened1cupgranulatedsugar1......
  • docker启动rabbitMQ,通过java创建交换机、队列、绑定
    通过docker启动rabbitMQdockerrun-d--namerabbitmq-p5671:5671-p5672:5672-p4369:4369-p25672:25672-p15671:15671-p15672:15672rabbitmq:management  将其修改为自启动:dockerupdaterabbitmq--restart=always  以下为通过java代码进行创建交换机......
  • What is RabbitMQ?-动力节点RabbitMQ章节笔记
    1. WhatisRabbitMQ?1.1简介RabbitMQ是一个广泛使用的消息服务器,采用Erlang语言编写,是一种开源的实现 AMQP(高级消息队列协议)的消息中间件;RabbitMQ最初起源于金融系统,它的性能及稳定性都非常出色;AMQP协议(http://www.amqp.org),即 AdvancedMessageQueuingProtocol,高级消息队......
  • 动力节点最新RabbitMQ笔记——1-6章What is RabbitMQ?
    1. WhatisRabbitMQ?1.1简介RabbitMQ是一个广泛使用的消息服务器,采用Erlang语言编写,是一种开源的实现 AMQP(高级消息队列协议)的消息中间件;RabbitMQ最初起源于金融系统,它的性能及稳定性都非常出色;AMQP协议(http://www.amqp.org),即 AdvancedMessageQueuingProtocol,高级消息队......