RabbitMQ

RabbitMQ(9)-REST API监控RabbitMQ

无人久伴 提交于 2020-01-07 07:33:54
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 一.介绍 Nagios Nagios 健康检测是一个独立的程序,它在运行时监控服务并在程序终止运行时退出代码来指示服务的健康状态,可以用任何语言来编写,检测程序可以将可读状态打印到 stdout 上,返回四种整型退出代码: 0----OK:接收检测的服务正常运行 1 ---- WARNING: 服务运行遇到问题,但并不紧急,比如内存到了监控阀值或者检测的队列属性错误等 2 ---- CRITICAL: 服务关闭无响应,并且超过受监控的临界值 3 ---- UNKONWN: 服务的状态或者监控的度量值无法确定 二.实战 1.工具类: import com.rabbitmq.client.ConnectionFactory; public class RabbitMQUtils extends ConnectionFactory{ //定义Nagios的健康状态值 public static final Integer EXIT_OK=0; public static final Integer EXIT_WARNING=1; public static final Integer EXIT_CRITICAL=2; public static final Integer EXIT_UNKNOWN=3; public

Operation failed: ExchangeBind; 404 (NOT-FOUND) with message "NOT_FOUND - no exchange 'dead.letters-q.1'

那年仲夏 提交于 2020-01-07 06:55:52
问题 as referenced in a previous question, i'm trying to use the wascally npm package with meteor and it's throwing what seems to be a setup/config error about my exchanges W20150925-14:22:34.692(-4)? (STDERR) W20150925-14:22:34.693(-4)? (STDERR) /Users/rkstar/dev/projects/wacoosta/.meteor/local/isopacks/npm-container/npm/node_modules/wascally/node_modules/when/lib/fatal.js:12 W20150925-14:22:34.693(-4)? (STDERR) throw e; W20150925-14:22:34.693(-4)? (STDERR) ^ W20150925-14:22:34.694(-4)? (STDERR)

RabbitMQ listener stops listening messages when MessageListener throws exception

微笑、不失礼 提交于 2020-01-07 05:20:27
问题 I am using Spring AMQP for processing the messages in RabbitMQ. Below is the issue: 1. (say) there are 3 messages in ready state inside RabbitMQ 2. First one is picked up by MessageListener and starts processing. (say) It ends up throwing an exception 3. In this case, the container remains up but the remaining 2 messages are not processed until i restart the container. Also the first messages stays in unacknowledged state. Is it the expected behavior? If not, how to make sure that other 2

What is the purpose of RabbitMQ AMQP Java client shutdown handlers? v2

◇◆丶佛笑我妖孽 提交于 2020-01-07 05:05:11
问题 What is the purpose of RabbitMQ AMQP Java client shutdown handlers? Is the accepted answer still valid? If server is lost, then ShutdownSignalException is thrown and therefore we "learn of the connection/channel closure". Also since version 3.3.0 there's automatic recovery. Does it mean adding my own ShutdownListener is not required anymore? (and therefore Lyra library is not useful anymore?) My usecase is that I send messages to rabbitmq cluster and when I stop the node that my client is

RabbitMQ中文文档PHP版本(一)--打印Hello World

蓝咒 提交于 2020-01-07 04:44:43
2019年12月10日09:54:28 原文: https://www.rabbitmq.com/tutorials/tutorial-one-php.html 介绍 先决条件 本教程假定RabbitMQ 已 在标准端口( 5672 )的 本地主机 上 安装 并运行 。 如果您使用其他主机,端口或凭据,则连接设置需要进行调整。 在哪里获得帮助 如果您在阅读本教程时遇到困难,可以 通过邮件列表 与我们 联系。 RabbitMQ是消息代理:它接受并转发消息。 您可以将其视为邮局:将要发布的邮件放在邮箱中时,可以确保Mailperson先生或女士最终将邮件传递给收件人。 以此类推,RabbitMQ是一个邮箱,一个邮局和一个邮递员。 RabbitMQ与邮局之间的主要区别在于,它不处理纸张,而是接收,存储和转发数据 消息的 二进制斑点 。 RabbitMQ和一般的消息传递使用一些术语。 生产仅 意味着发送。 发送消息的程序是 生产者 : 队列 是RabbitMQ内部的邮箱的名称。 尽管消息流经RabbitMQ和您的应用程序,但它们只能存储在 队列中 。 甲 队列 仅由主机的存储器&磁盘限制约束,它本质上是一个大的消息缓冲器。 许多 生产者 可以发送进入一个队列的消息,许多 消费者 可以尝试从一个 队列 接收数据 。 这就是我们表示队列的方式: 消费 与接收具有相似的含义。 一个 消费者

Spring Boot (5) 整合 RabbitMQ

那年仲夏 提交于 2020-01-07 03:19:05
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 一、前言 RabbitMQ 是实现了 AMQP (高级消息队列协议)的开源消息中间件,RabbitMQ服务器是用 Erlang (面向并发的编程语言)编写的。 RabbitMQ官网下载地址: https://www.rabbitmq.com/download.html Docker部署则执行如下命令即可 # RABBITMQ_DEFAULT_USER:用户名,RABBITMQ_DEFAULT_PASS:密码 这里修改为自己的即可 docker run -d --name rabbitmq -p 5672:5672 -p 15672:15672 -v `pwd`/rabbitmq/data:/var/lib/rabbitmq --hostname my-rabbit --restart=always -e RABBITMQ_DEFAULT_VHOST=my_vhost -e RABBITMQ_DEFAULT_USER=admin -e RABBITMQ_DEFAULT_PASS=admin rabbitmq:3-management 温馨小提示:本文只是简单的通过 rabbitmq 去 发送消息 和 接收消息 ,适用于新手简单入门了解~ 二、SpringBoot 整合 RabbitMQ 1、 pom.xml

linux环境配置RabbitMQ

无人久伴 提交于 2020-01-07 03:10:57
Linux 安装mq centos 是基于 linux 建立的操作系统。 安装需要插件 使用yum方式安装 yum - y install make gcc gcc - c ++ kernel - devel m4 ncurses - devel openssl - devel unixODBC - devel erlang 因为 RabbitMQ 需要 Erlang 的环境,所以需要先安装 Erlang yum install erlang 安装完成后可以检测是否安装成功,使用如下命令: Erl 安装成功 进入 Erlang 后可以使用如下命令退出 Erlang : q (). 安装rabbitMQ wget https : // www . rabbitmq . com / releases / rabbitmq - server / v3 .6 . 8 / rabbitmq - server -3.6 . 8 - 1 . el7 . noarch . rpm 然后 rpm -- import https : // www . rabbitmq . com / rabbitmq - release - signing - key . asc yum install rabbitmq - server -3.6 . 8 - 1 . el7 . noarch . rpm rpm -

@ConditionalOnBean导致自动配置无效的问题

青春壹個敷衍的年華 提交于 2020-01-07 01:56:37
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 本文 代码下载 Spring Boot为我们提供了很多注解来方便我们开发项目,比如使用@ConditionalOnXXX注解来控制Bean的加载。但是前几天发现自动配置加了@ConditionalOnBean注解后,竟然没有生效,花了很长时间最终解决了,在此记录一下。 一、代码简介 首先将示例代码打开,直接运行,可以看到有日志输出,证明一切正常 然后我们简单介绍一下示例代码中主要的类 1、RabbitAutoConfiguration.java /** * 当local-config.rabbitmq.init配置为true的时候,加载配置类 * 同时将ConnectionFactory注册为bean */ @Configuration @ConditionalOnProperty(name = "local-config.rabbitmq.init", havingValue = "true") public class RabbitAutoConfiguration { @Bean public ConnectionFactory connectionFactory() { return new ConnectionFactory(); } } 2、WebsocketAutoConfiguration

RabbitMQ 进阶

China☆狼群 提交于 2020-01-07 01:34:28
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 消息何去何从: mandatory 和 immediate 是 channel.basicPublish 方法中的两个参数,它们都有当消息传递过程中不可达目的地时将消息返回给生产者的功能。RabbitMQ 提供的备份交换器(Alternate Exchange)可以将未能被交换器路由的消息(没有绑定队列或者没有匹配的绑定)存储起来,而不用返回给客户端。 mandatory 参数: 当 mandatory 参数设为 true 时,交换器无法根据自身的类型和路由键找到一个符合条件的队列,那么 RabbitMQ 会调用 Basic.Return 命令将消息返回给生产者。当 mandatory 参数设置为 false 时,出现上述情形,则消息直接被丢弃。 生产者如何获取到没有被正确路由到合适队列的消息呢?这时候可以通过调用 channel.addReturnListener 来添加 ReturnListener 监听器实现。 使用 mandatory 参数的关键代码如下: channel.basicPublish(EXCHAGE_NAME, "", true, MessageProperties.PERSISTENT_TEXT_PLAIN, "mandatory test".getBytes()); channel

RabbitMQ中文文档PHP版本(五)--主题

坚强是说给别人听的谎言 提交于 2020-01-07 00:22:33
2019年12月10日10:05:11 原文: https://www.rabbitmq.com/tutorials/tutorial-five-php.html 话题 (使用 php-amqplib ) 先决条件 本教程假定RabbitMQ 已 在标准端口( 5672 )的 本地主机 上 安装 并运行 。 如果您使用其他主机,端口或凭据,则连接设置需要进行调整。 在哪里获得帮助 如果您在阅读本教程时遇到困难,可以 通过邮件列表 与我们 联系。 在上 一教程中, 我们改进了日志记录系统。 我们没有使用只能进行虚拟广播 的 扇出 交换机,而是使用 直接 交换机 ,并有可能选择性地接收日志。 尽管使用 直接 交换改进了我们的系统,但它仍然存在局限性-它不能基于多个条件进行路由。 在我们的日志记录系统中,我们可能不仅要根据严重性订阅日志,还要根据发出日志的源订阅日志。 您可能从 syslog unix工具中 了解了这个概念,该 工具根据严重性(info / warn / crit ...)和工具(auth / cron / kern ...)路由日志。 这将为我们提供很大的灵活性-我们可能只想听来自“ cron”的严重错误,也可以听“ kern”的所有日志。 为了在日志系统中实现这一点,我们需要学习更复杂的 主题 交换。 话题交流 发送到 主题 交换的 消息 不能具有任意的