ActiveMQ配置详解之如何配置自动重新连接
2019独角兽企业重金招聘Python工程师标准>>>
ActiveMQ配置详解之如何配置自动重新连接 博客分类: MQ
The Failover(故障转移) Transport(注:这里自然可以翻译为“传输”,但是从根本上来说,我认为主要是在于故障转移是在传输层完成)
Configuration Syntax
or
failover:uri1,...,uriN
failover:(tcp://primary:61616,tcp://secondary:61616)?randomize=false
这些下面的这些参数都可以通过类似http参数传值的方式failover:(tcp://host1:61616,tcp://host2:61616,...)?p1=v1&p2=v2&p3=v3将参数p1,p2,p3传入。
Transport Options
initialReconnectDelay | 10 | How long to wait before the first reconnect attempt (in ms) |
maxReconnectDelay | 30000 | The maximum amount of time we ever wait between reconnect attempts (in ms) |
useExponentialBackOff | true | Should an exponential backoff be used btween reconnect attempts (在尝试重新连接时是否使用指数回退算法) |
backOffMultiplier | 2.0 | The exponent used in the exponential backoff attempts |
maxReconnectAttempts |
-1 >= AMQ v5.6 0 < AMQ v5.6, |
From version 5.6 onwards: -1 is default and means retry forever, 0 means don't retry (only try connection once but no retry). Prior to version 5.6: 0 is default and means retry forever. All versions: If set to >0, then this is the maximum number of reconnect attempts before an error is sent back to the client. (这里要注意从v5.6版本以后出现的变化) |
startupMaxReconnectAttempts | 0 |
If not 0, then this is the maximum number of reconnect attempts before an error is sent back to the client on the first attempt by the client to start a connection, once connected the maxReconnectAttempts option takes precedence.
( 设定一个连接创建成功之前尝试连接的最大次数)
|
randomize | true | use a random algorithm to choose the the URI to use for reconnect from the list provided |
backup | false |
initialize and hold a second transport connection - to enable fast failover
( 如果backup=true,并且the URIs to use for reconnect from the list provided的数量大于一个的情况下,broker将会维护着两个连接,其中一个作为备份,在主连接出现故障时实现快速切换 )
|
timeout | -1 |
Enables timeout on send operations (in miliseconds) without interruption of reconnection process
( 默认为-1,也就是timeout为forever)
|
trackMessages | false |
keep a cache of in-flight messages that will flushed to a broker on reconnect
( 设置是否缓存[故障发生时]尚未传送完成的消息,当broker一旦重新连接成功,便将这些缓存中的消息刷新到新连接的代理中,使得消息可以在broker切换前后顺利传送)
|
maxCacheSize | 131072 |
size in bytes for the cache, if trackMessages is enabled
(设定消息缓存时的最大缓存大小,默认为128MB)
|
updateURIsSupported | true |
Determines whether the client should accept updates to its list of known URIs from the connected broker. Added in ActiveMQ 5.4
( 设定客户端是否应该接受从连接代理更新其已知的URI列表。特性版本:ActiveMQ 5.4+)
|
Example URI
failover:(tcp://localhost:61616,tcp://remotehost:61616)?initialReconnectDelay=100
failover://(tcp://localhost:61616,tcp://remotehost:61616)?initialReconnectDelay=100
Notes
Additionally you can use timeout option which will cause your current send to fail after specified timeout. The following URL, for example
failover:(tcp://primary:61616)?timeout=3000
Transactions
Starting in version 5.3.1, redelivery order is tracked and a transaction will fail to commit (throw a TransactionRolledBackException) if outstanding messages are not redelivered after failover. In addition, in doubt transaction will now result in a rollback such that they can be replayed by the application.( 在5.3.1版本开始,重新传递顺序被跟踪以及事务将无法提交(抛出一个TransactionRolledBackException的异常),如果突出的消息是没有故障转移后重新传递的。此外,有疑问的事务将导致回滚,以便它们可以被应用程序重放。) In doubt transactions occur when failover happens with a commit message inflight. ( 有疑问事务出现在故障转移时有尚未提交的消息。)It is not possible to know the exact point of failure. Did the transaction commit message get delivered or was it just the commit reply that is lost? In this case, it is necessary to rollback so that the application can get an indication of the failure and deal with any potential problem.
Broker side Options for Failover(broker端的选项设置)
updateClusterClients | false |
if true, pass information to connected clients about changes in the topology of the broker cluster( 代理群集的拓扑)
|
rebalanceClusterClients | false | if true, connected clients will be asked to rebalance(负载均衡) across a cluster of brokers when a new broker joins the network of brokers |
updateClusterClientsOnRemove | false |
if true, will update clients when a cluster is removed from the network. Having this as separate option enables clients to be updated when new brokers join, but not when brokers leave.
动态更新连接到server的broker cluster的结构
|
updateClusterFilter | null |
comma separated list of regular expression filters used to match broker names of brokers to designate as being part of the failover cluster for the clients
( 这是一个用逗号分隔的正则过滤集合,它用来匹配broker的名字,符合条件的broker将被用于故障转移)
|
updateURIsURL | null | A URL (or path to a local file) to a text file containing a comma separated list of URIs to use for reconnect in the case of failure |
...
< transportConnectors >
< transportConnector name ="openwire" uri ="tcp://0.0.0.0:61616" updateClusterClients ="true" updateClusterFilter ="*A*,*B*" />
</ <transportConnectors>
...
</ broker >
failover://tcp://primary:61616
More Information
Priority Backup(指定备份代理集合中的优先级)
转载于:https://my.oschina.net/xiaominmin/blog/1597393
ActiveMQ配置详解之如何配置自动重新连接相关推荐
- Spring配置详解,Spring配置元信息详解,Spring配置大全及源码分析
文章目录 一.Spring都可以配置哪些元信息 二.Spring Bean 配置元信息 1.GenericBeanDefinition 2.RootBeanDefinition 3.Annotated ...
- activemq mysql 配置详解_activeMQ数据库配置
ActiveMQ很好的支持了消息的持久性(Persistence).消息持久性对于可靠消息传递来说应该是一种比较好的方法,有了消息持久化, 即使发送者和接受者不是同时在线或者消息中心在发送者发送消息后 ...
- freeswitch 用户配置详解_FreeSwitch安装配置记录-阿里云开发者社区
安装FreeSwitch 主要命令如下: git clone -b v1.2.stable git://git.freeswitch.org/freeswitch.git cd freeswitch/ ...
- mysql主从从配置详解_MySQL主从配置详解
● 本打算买个云数据,为我的新项目做点安全保障.阿里云,腾讯云转了一圈,两个字太贵.不就数据有备份吗,既然这样那我不如自己来做备份. ● 家里有2个树莓派直接把mysql备份到他们上就好了,网上有教程 ...
- druid mysql配置详解_druid 参数配置详解
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource #驱动配置信息 spring.datasource.driver-class ...
- babel 用法及其 .babelrc 的配置详解,想做前端架构,拒绝一知半解...
Babel 官方介绍:将 ECMAScript 2015 及其版本以后的 javascript 代码转为旧版本浏览器或者是环境中向后兼容版本的 javascript 代码. 简而言之,就是把不兼容的 ...
- application.yaml配置详解
application.yaml配置详解 application.yaml配置主要分为三部分 server 服务端配置项 client 客户端配置项 instance 实例配置项 服务端配置项 ser ...
- [Samba] Linux(Centos)samba服务安装,Samba文件共享及Samba配置详解
本片博客主要介绍了[Samba] Linux(Centos)samba文服务器安装案例,samba共享,samba服务,samba配置详解及网页配置samba工具samba-swat 的使用方法等. ...
- 实时监控、直播流、流媒体、视频网站开发方案流媒体服务器搭建及配置详解:使用nginx搭建rtmp直播、rtmp点播、,hls直播服务配置详解
注意:这里不会讲到nginx流媒体模块如何安装的问题,只研究rtmp,hls直播和录制相关的nginx服务器配置文件的详细用法和说明.可以对照这些命令详解配置nginx -rtmp服务 一.nginx ...
最新文章
- 利用反射对应数据库字段
- crypt错误分析和解决
- 软定时器的原理与创建
- python连接mongo数据库
- 悲观锁和乐观锁_悲观锁和乐观锁处理并发操作
- 日期getUTCSeconds()方法以及JavaScript中的示例
- 一文读懂单目视觉SLAM分类方法~基于概率框架和非概率框架
- POST—GET—两种提交方式的区别
- tcpdump命令--详解
- Linux中脚本的使用方法
- 网络管理软件免费linux,最新Xmanager Power Suite6网络管理工具免费官方下载6.0.199 - 系统之家...
- linux php 源码安装,Linux下PHP的源码安装与配置
- 计算机基础及应用期末,《计算机应用基础》期末复习综合练习题及答案
- Oracle下载安装:
- 两个pdf合并成一个pdf
- java判断一个数是不是素数_Java-判断一个数是不是素数
- 文件夹自动生成目录树(批处理)
- cocos2d-x 3.2 之 三消类游戏——万圣大作战
- Echarts 实现树状图的展示与编辑示例
- 电梯导航a链接锚点跳转生硬
热门文章
- Node.js怎么处理数据库中日期类型
- HoloLens开发手记 - 使用混合现实捕捉 Using mixed reality capture
- position:absolute的小坑
- javascript阻止事件冒泡和浏览器的默认行为
- Shiro的多Realm验证的实现--shiro实现不同身份使用不同Realm进行验证
- 单系统站内信设计概述(满足百万级信息)
- Jmeter基础之JMeter参数化补充练习
- udt编写高性能服务器,基于UDT协议的Oracle数据库远程备份的设计和实现
- Spring 使用AOP
- c语言堆栈基本代码入栈出栈_几道和「堆栈、队列」有关的面试算法题