activemq

ActiveMq生产者流量控制(Producer Flow Control)

℡╲_俬逩灬. 提交于 2020-01-03 20:23:32
/*--> */ /*--> */ 最近学习ActiveMq,昨日查看其配置文件activemq.xml的时候,被一行注释引到了 http://activemq.apache.org/producer-flow-control.html 页面,感觉挺有用,遂翻译之保存成文。作为自己的第一篇译作,必有诸多不妥之处,故附上原文作对照,欢迎拍砖。 Producer Flow Control 生产者流量控制 In ActiveMQ 4.x flow control was implemented using TCP flow control. The underlying network connection of throttled consumers was suspended to enforce flow control limits. This strategy is very efficient but can lead to deadlocks if there are multiple producers and consumers sharing the same connection. 在ActiveMQ 4.x版本中,流量控制是用TCP流量控制实现的。受节制的消费者底层的网络连接被挂起,以强制进行流量控制限制。这个策略非常高效

java消息队列--ActiveMQ

我只是一个虾纸丫 提交于 2020-01-03 20:22:13
1、下载安装ActiveMQ   ActiveMQ官网下载地址: http://activemq.apache.org/download.html   ActiveMQ 提供了Windows 和Linux、Unix 等几个版本,楼主这里选择了Linux 版本下进行开发。   下载完安装包,解压之后的目录:     从它的目录来说,还是很简单的: bin存放的是脚本文件 conf存放的是基本配置文件 data存放的是日志文件 docs存放的是说明文档 examples存放的是简单的实例 lib存放的是activemq所需jar包 webapps用于存放项目的目录 2、启动ActiveMQ    进入到ActiveMQ 安装目录的Bin 目录,linux 下输入 ./activemq start 启动activeMQ 服务。    输入命令之后,会提示我们创建了一个进程IP 号,这时候说明服务已经成功启动了。      ActiveMQ默认启动时,启动了内置的jetty服务器,提供一个用于监控ActiveMQ的admin应用。   admin: http://127.0.0.1:8161/admin/   我们在浏览器打开链接之后输入账号密码(这里和tomcat 服务器类似)   默认账号:admin   密码:admin       到这里为止,ActiveMQ 服务端就启动完毕了。

ActiveMQ入门实例

送分小仙女□ 提交于 2020-01-03 20:16:45
package org.apollo.demo.jms.test01; import java.io.Serializable; import javax.jms.Connection; import javax.jms.ConnectionFactory; import javax.jms.Destination; import javax.jms.JMSException; import javax.jms.Message; import javax.jms.MessageProducer; import javax.jms.Session; import org.apache.activemq.ActiveMQConnection; import org.apache.activemq.ActiveMQConnectionFactory; public class Sender { /** * 在服务器创建的主题名称 */ public static String TOPIC_NAME="TemplateTopic"; public static String BROKER_URL="tcp://localhost:61616"; /** * 连接工厂 */ private ConnectionFactory connectionFactory; /* * 创建连接池 */

ActiveMQ入门实例

依然范特西╮ 提交于 2020-01-03 20:16:21
1.下载ActiveMQ 去官方网站下载: http://activemq.apache.org/ 2.运行ActiveMQ 解压缩apache-activemq-5.5.1-bin.zip,然后双击apache-activemq-5.5.1\bin\activemq.bat运行ActiveMQ程序。 启动ActiveMQ以后,登陆: http://localhost:8161/admin/ ,创建一个Queue,命名为FirstQueue。 3.创建Eclipse项目并运行 创建project:ActiveMQ-5.5,并导入apache-activemq-5.5.1\lib目录下需要用到的jar文件,项目结构如下图所示: 3.1.Sender.java package com.xuwei.activemq;import javax.jms.Connection;import javax.jms.ConnectionFactory;import javax.jms.DeliveryMode;import javax.jms.Destination;import javax.jms.MessageProducer;import javax.jms.Session;import javax.jms.TextMessage;import org.apache.activemq

深入浅出JMS(二)--ActiveMQ简单介绍以及安装

跟風遠走 提交于 2020-01-03 20:07:01
现实的企业中,对于消息通信的应用一直都非常的火热,而且在J2EE的企业应用中扮演着特殊的角色,所以对于它研究是非常有必要的。 上篇博文 深入浅出JMS(一)–JMS基本概念 ,我们介绍了消息通信的规范JMS,我们这篇博文介绍一款开源的JMS具体实现——ActiveMQ。ActiveMQ是一个易于使用的消息中间件。 消息中间件 我们简单的介绍一下消息中间件,对它有一个基本认识就好,消息中间件(MOM:Message Orient middleware)。 消息中间件有很多的用途和优点: 1. 将数据从一个应用程序传送到另一个应用程序,或者从软件的一个模块传送到另外一个模块; 2. 负责建立网络通信的通道,进行数据的可靠传送。 3. 保证数据不重发,不丢失 4. 能够实现跨平台操作,能够为不同操作系统上的软件集成技工数据传送服务 MQ 首先简单的介绍一下MQ,MQ英文名MessageQueue,中文名也就是大家用的消息队列,干嘛用的呢,说白了就是一个消息的接受和转发的容器,可用于消息推送。 下面进入我们今天的主题,为大家介绍ActiveMQ: ActiveMQ 简要概述ActiveMQ Apache ActiveMQ ™ is the most popular and powerful open source messaging and Integration Patterns

Publishing messages to ActiveMQ using Gatling

和自甴很熟 提交于 2020-01-03 18:58:21
问题 I have been using Gatling to publish messages to ActiveMq server. I get "java.lang.SecurityException: Invalid username: null or empty" tho I use valid username and password. Here is my test code and the exception were thrown. Any inputs on how to fix this will be of help. import io.gatling.core.Predef.Simulation import io.gatling.core.Predef._ import io.gatling.jms.Predef._ import io.gatling.core.config.Credentials import org.apache.activemq.ActiveMQConnectionFactory import org.apache

Using Circuit Breaker with camel -ThrottlingExceptionRoutePolicy

≯℡__Kan透↙ 提交于 2020-01-03 03:28:11
问题 There is a route which is consuming messages from a jms queue and after doing some processing sending a request to unreliable web service(Which can be down at times). So in case of service is down then i need to stop consuming from queue for some time. I tried to use ThrottlingExceptionRoutePolicy . It will stop route as per configuration but issue is for the current message which gets the error as message is getting moved to dead letter queue. I've gone through the code of

JMS MessageConsumer Using MessageListener Terminates on ActiveMQ Shutdown

自作多情 提交于 2020-01-03 02:59:10
问题 Trying to have a JMS MessageConsumer survive ActiveMQ reboots, so it can reconnect using the Failover Transport protocol. However, it terminates upon shutdown of ActiveMQ. This looks like a bug that was reported and "resolved", but I'm still seeing this in the latest version of ActiveMQ 5.10.0 I used the following maven dependency <dependency> <groupId>org.apache.activemq</groupId> <artifactId>activemq-all</artifactId> <version>5.10.0</version> </dependency> Here is some sample code using

SpringBoot application publish and read from ActiveMQ topic

流过昼夜 提交于 2020-01-03 02:47:30
问题 I have two receivers that should read from a topic. But only one random receiver gets message like it's actually reading from a queue not a topic. I've read this answer but it doesn't seem to be working. Here is my code. Application.java: package hello; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.jms.DefaultJmsListenerContainerFactoryConfigurer; import org.springframework

ActiveMQ 笔记(八)高级特性和大厂常考重点

假如想象 提交于 2020-01-02 15:08:10
1、可用性保证 引入消息队列之后该如何保证其高可用性? 持久化、事务、签收、 以及带复制的 Leavel DB + zookeeper 主从集群搭建 2、异步投递Async Sends 2.1 异步投递的定义 对于一个Slow Consumer,使用同步发送消息可能出现Producer堵塞的情况,慢消费者适合使用异步发送 如图介绍: 2.2 什么是异步投递 ActiveMQ支持同步,异步两种发送的模式将消息发送到broker,模式的选择对发送延时有巨大的影响。producer能达到怎么样的产出率(产出率=发送数据总量/时间)主要受发送延时的影响,使用异步发送可以显著提高发送的性能。 ActiveMQ默认使用异步发送的模式:除非明确指定使用同步发送的方式或者在未使用事务的前提下发送持久化的消息,这两种情况都是同步发送的。 如果你没有使用事务且发送的是持久化的消息,每一次发送都是同步发送的且会阻塞producer知道broker返回一个确认,表示消息已经被安全的持久化到磁盘。确认机制提供了消息安全的保障,但同时会阻塞客户端带来了很大的延时。 很多高性能的应用,允许在失败的情况下有少量的数据丢失。如果你的应用满足这个特点,你可以使用异步发送来提高生产率,即使发送的是持久化的消息。 异步发送 它可以最大化producer端的发送效率。我们通常在发送消息量比较密集的情况下使用异步发送