activemq

ActiveMQ集群搭建

纵饮孤独 提交于 2019-11-28 03:04:13
在虚拟机安装centos7,要提前安装好jdk环境 工作流程: 在 ZooKeeper 中管理多个 Broker 节点,根据 Master 选举策略让其中一个 Broker 选举为 Master (只有 Master 才具备对外提供服务的能力),剩下 Broker 为 slave 。 编码时, client 端(消费者)通过 failover 协议来连接 ActiveMQ 集群。 一、zookeeper 安装配置 服务端口 投票端口 选举端口 zk1 2181 2887 3887 zk2 2182 2888 3888 zk3 2183 2889 3889 在/Tools/zookeeper下复制3个zookeeper服务,并分别配置它们的文件conf/zoo.cfg: zk1. # /home/admin/Tools/zookeeper01 虚拟机zookeeper安装路径 dataDir=/home/admin/Tools/zookeeper0 1 /data dataLogDir=/home/admin/Tools/zookeeper0 1 /log #服务端口 clientPort=2181 # zk集群之间的通信地址 server.1= 192.168.23.129 :2887:3887 server.2= 192.168.23.129 :2888:3888 server

JMS Topic vs Queues

巧了我就是萌 提交于 2019-11-28 02:38:15
I was wondering what is the difference between a JMS Queue and JMS Topic. ActiveMQ page says Topics In JMS a Topic implements publish and subscribe semantics. When you publish a message it goes to all the subscribers who are interested - so zero to many subscribers will receive a copy of the message. Only subscribers who had an active subscription at the time the broker receives the message will get a copy of the message. Queues A JMS Queue implements load balancer semantics. A single message will be received by exactly one consumer. If there are no consumers available at the time the message

ActiveMQ 5.x 消息队列

非 Y 不嫁゛ 提交于 2019-11-28 01:58:27
1.安装 ActiveMQ 这里以 ActiveMQ 5.15.3 版本为例,下载地址: http://activemq.apache.org/activemq-5153-release.html 官网提供的快速开始案例: http://activemq.apache.org/getting-started.html 下载完以后,解压到用户自定义的目录下 如果我们是 32 位的机器,就双击 win32 目录下的 activemq.bat,如果是 64 位机器,则双击 win64 目录下的 activemq.bat 启动后访问路径 http://127.0.0.1:8161/,用户名和密码默认都是 admin 新增消息队列 2. Spring Boot 2.X 整合 ActiveMQ 之点对点消息 官网地址: https://docs.spring.io/spring-boot/docs/2.1.0.BUILD-SNAPSHOT/reference/htmlsingle/#boot-features-activemq 步骤1:加入依赖 <!-- 整合消息队列ActiveMQ --> <dependency>   <groupId>org.springframework.boot</groupId>   <artifactId>spring-boot-starter-activemq<

消息队列深入解析

∥☆過路亽.° 提交于 2019-11-28 01:31:40
目录 消息队列和消息 常见的消息队列有那些? 使用消息队列的场景和好处 1.通过异步处理提高系统性能 2.降低系统耦合性 常见的消息队列介绍 1.ActiveMQ 2.RabbitMQ 3. Kafka 4. RocketMQ 消息队列和消息 “消息队列” (Message queue)是在消息的传输过程中保存消息的容器。 “消息” 是在两台计算机间传送的数据单位。消息可以非常简单,例如只包含文本字符串;也可以更复杂,可能包含嵌入对象。 常见的消息队列有那些? 当前使用较多的消息队列有 RabbitMQ 、 ActiveMQ 、 RocketMQ 、 Kafka 等等,我们之前提高的redis数据库也可以实现消息队列,不过不推荐,redis本身设计就不是用来做消息队列的。 使用消息队列的场景和好处 《大型网站技术架构》第四章和第七章均有提到消息队列对应用性能及扩展性的提升。 1.通过异步处理提高系统性能 如上图, 在不使用消息队列服务器的时候,用户的请求数据直接写入数据库,在高并发的情况下数据库压力剧增,使得响应速度变慢。但是在使用消息队列之后,用户的请求数据发送给消息队列之后立即 返回,再由消息队列的消费者进程从消息队列中获取数据,异步写入数据库。由于消息队列服务器处理速度快于数据库(消息队列也比数据库有更好的伸缩性),因此响应速度得到大幅改善。 通过以上分析我们可以得出

Jmeter-JMS Test Plan

杀马特。学长 韩版系。学妹 提交于 2019-11-27 21:24:03
参考:https://blog.csdn.net/fanxiyanhong/article/details/51479532 https://www.cnblogs.com/Owen-ET/p/8986348.html#no0 MOM 作为消息数据交换的平台,也是影响应用执行效率的潜在环节。在 Java 程序中,是通过 JMS 与 MOM 进行交互的。作为 Java 实现的压力测试工具,JMeter 也能使用 JMS对应用的消息交换和相关的数据处理能力进行测试。这一点应该不难理解,因为在整个测试过程中,JMeter 测试的重点应该是消息的产生者和消费者的本身能力,而不是 MOM本身。 JMS提供了两种消息通信模型: Ø 点到点(P2P)模型 Ø 发布/订阅(Pub/Sub)模型 在ClientA、C、D之间的消息是点对点模型,使用这种模型,客户端发送消息到队列目的地(Queue),从这个队列里面只有一个消息接收者可以收到那个消息,其他访问同一目的地的接收者不会接收到该消息。如ClientC接收Queue中的Msg1消息,ClientD接收Queue中的Msg2消息。 在ClientB、E、F之间的消息是发布/订阅模型。使用这种广播模型,一个客户端发送消息给主题目的地(Topic),任何数量的消费订阅者可以从这个主题目的地来接收它们。如

multiple SLF4J bindings Error with activemq-all-5.6.0.jar

本小妞迷上赌 提交于 2019-11-27 20:05:49
When I upgrade to activemq-all-5.6.0 I get this error during server startup SLF4J: Class path contains multiple SLF4J bindings I don't have this issue when using activemq-all-5.5.1 On checking I do find that there StaticLoggerBinder.class in both activemq-all-5.6.0.jar and slf4j-log4j12-1.5.10.jar which is causing the issue Please do help in debugging this issue My pom.xml is as follows <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> <version>1.5.10</version> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>jcl-over-slf4j</artifactId> <version>1

activeMQ(2)

℡╲_俬逩灬. 提交于 2019-11-27 19:38:22
queue与topic的对比 JMS MESSAGE:消息头 消息体 消息属性 DeliveryMode: 消息体: 消息属性:识别 去重 重点标注 //创建会话session 事务、签收 如果设置成 true 在session.close()之前 要加上 session.commit() session.rollback()可在出错之后进行回滚//如果不是自动签收 手动签收的话 需要 message.acknowledge();来签收 Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); 可靠性的保证:持久性 事务 签收 connection.setClientID("000"); 来源: https://www.cnblogs.com/ustc-anmin/p/11374566.html

ActiveMq-常见的问题

£可爱£侵袭症+ 提交于 2019-11-27 19:22:06
1.服务挂掉 ActiveMQ的储存机制: 在通常的情况下,非持久化消息是存储在内存中的,持久化消息是存储在文件中的,它们的最大限制在配置文件的节点中配置。 如果,在非持久化消息堆积到一定程度,内存告急的时候,ActiveMQ会将内存中的非持久化消息写入临时文件中,以腾出内存。 虽然都保存到了文件里,但它和持久化消息的区别是,重启后持久化消息会从文件中恢复,非持久化的临时文件会直接删除。 持久化存储 当消息量足够大时,持久化消息存储文件超过最大限制(比如设置文件最大2G)。 此时生产者发送消息阻塞,但消费者可正常连接并消费消息,等消息消费掉一部分,文件删除又腾出空间之后,生产者又可继续发送消息,服务自动恢复正常。 非持久化存储 当采用非持久化消息设置后,消息量足够大时,非持久化消息存储文件超过最大限制(假设设置最大2G)。 这时生产者阻塞,而消费者可以连接,却不能消费或者原本慢速消费的消费者,消费突然停止。整个系统可连接,但是无法提供服务,就这样挂了。 解决方案: 此时,可以看出为了保证消息的安全性和服务稳定,最好采用消息持久化,如果不用,在部分情况下应增大临时文件限制。 2.消息丢失 这得从java的java.net.SocketException异常说起。 简单点说就是当网络发送方发送一堆数据,然后调用close关闭连接之后。这些发送的数据都在接收者的缓存里

Integration of JavaScript and JMS [closed]

笑着哭i 提交于 2019-11-27 18:59:49
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 2 years ago . Where can I find a guide for integrating JavaScript and JMS (Java Messaging Service)? I would like a best practice or established technology that allows me to directly or indirectly receive messages from a topic and update a site based on the message. I was thinking of creating two components, a servlet for the

解决Springboot整合ActiveMQ发送和接收topic消息的问题

大城市里の小女人 提交于 2019-11-27 18:04:20
环境搭建 1.创建maven项目(jar) 2.pom.xml添加依赖 <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.4.0.RELEASE</version> </parent> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-activemq</artifactId> </dependency> </dependencies> 3.编写引导类