An Apache ActiveMQ connection can be configured by explicitly setting properties on the ActiveMQConnection or ActiveMQConnectionFactory objects themselves via the bean properties or using the following URI syntax.

Example

You set the property called jms.$PROPERTY on a regular connection URI. For example you can set the brokerURL on your ActiveMQConnectionFactory to the following value to enable Async Sends

tcp://localhost:61616?jms.useAsyncSend=true

Connection Options

The following options should be prefixed with jms. when used on a URI when connecting to a broker.

Option Name Default Value Description
 alwaysSessionAsync  true If this flag is set then a separate thread is used for dispatching messages for each Session in the Connection. However, a separate thread is always used if there is more than one session, or the session isn't in auto acknowledge or dups ok mode
 checkForDuplicates  true If this flag is set to true, the consumer will check for duplicate messages and properly handle the message to make sure that it is not processed twice inadvertently.
 clientID  null Sets the JMS clientID to use for the connection
 closeTimeout  15000ms  Sets the timeout before a close is considered complete. Normally a close() on a connection waits for confirmation from the broker; this allows that operation to timeout to save the client hanging if there is no broker.
 copyMessageOnSend  true Should a JMS message be copied to a new JMS Message object as part of the send() method in JMS. This is enabled by default to be compliant with the JMS specification. You can disable it if you do not mutate JMS messages after they are sent for a performance boost. 
 disableTimeStampsByDefault  false Sets whether or not timestamps on messages should be disabled or not. If you disable them it adds a small performance boost. 
 dispatchAsync  false Should the broker dispatch messages asynchronously to the consumer. 
 nestedMapAndListEnabled  true Enables/disables whether or not Structured Message Properties and MapMessages are supported so that Message properties and MapMessage entries can contain nested Map and List objects. Available since version 4.1 onwards 
 objectMessageSerializationDefered  false When an object is set on an ObjectMessage, the JMS spec requires the object to be serialized by that set method. Enabling this flag causes the object to not get serialized. The object may subsequently get serialized if the message needs to be sent over a socket or stored to disk. 
 optimizeAcknowledge  false Enables an optimised acknowledgement mode where messages are acknowledged in batches rather than individually. Alternatively, you could use Session.DUPS_OK_ACKNOWLEDGE acknowledgement mode for the consumers which can often be faster. WARNING enabling this issue could cause some issues with auto-acknowledgement on reconnection 
 optimizeAcknowledgeTimeOut  300ms if > 0, specifies the max time between batch acks when optimizeAcknowledge is enabled. (since 5.6) 
 optimizedAckScheduledAckInterval  0 if > 0, specifies a time interval upon which all the outstanding acks are delivered when optimized acknowledge is used so that a long running consumer that doesn't receive any more messages will eventually ack the last few unacked messages (since 5.7) 
 optimizedMessageDispatch  true If this flag is set then an larger prefetch limit is used - only applicable for durable topic subscribers 
 useAsyncSend  false Forces the use of Async Sends which adds a massive performance boost; but means that the send() method will return immediately whether the message has been sent or not which could lead to message loss. 
 useCompression  false Enables the use of compression of the message bodies 
 useRetroactiveConsumer  false Sets whether or not retroactive consumers are enabled. Retroactive consumers allow non-durable topic subscribers to receive old messages that were published before the non-durable subscriber started. 
 warnAboutUnstartedConnectionTimeout  500 Enables the timeout in milliseconds from a connection creation to when a warning is generated if the connection is not properly started via Connection.start() and a message is received by a consumer. It is a very common gotcha to forget to start the connection and then wonder why no messages are delivered so this option makes the default case to create a warning if the user forgets. To disable the warning just set the value to < 0 (say -1). 
 auditDepth  2048 The size of the message window that will be audited (for duplicates and out of order messages 
 auditMaximumProducerNumber  64 Maximum number of producers that will be audited
 alwaysSyncSend  false When true a MessageProducer will always use Sync sends when sending a Message even if it is not required for the Delivery Mode 
 consumerExpiryCheckEnabled  true Controls whether message expiration checking is done in each MessageConsumer prior to dispatching a message. Disabling this check can lead to consumption of expired messages. (since 5.11) 

Nested Options

You can also configure nested objects on the connection object using the given prefixes. See the javadoc for a breakdown of each individual property.

Option Name Object configured See Also
 jms.blobTransferPolicy.*   BlobTransferPolicy  Blob Message
 jms.prefetchPolicy.*  ActiveMQPrefetchPolicy   What is the prefetch limit for 
 jms.redeliveryPolicy.*  RedeliveryPolicy  Redelivery Policy

ActiveMQ(5.10.0) - Connection Configuration URI的更多相关文章

  1. ActiveMQ(5.10.0) - Configuring the JAAS Authentication Plug-in

    JAAS provides pluggable authentication, which means ActiveMQ will use the same authentication API re ...

  2. ActiveMQ 5.10.0 安装与配置

    先在官网下载activeMQ,我这里是5.10.0. 然后在解压在一个文件夹下即可. 我这里是:D:\apache-activemq-5.10.0-bin 然后进入bin目录:D:\apache-ac ...

  3. ActiveMQ(5.10.0) - Building a custom security plug-in

    If none of any built-in security mechanisms works for you, you can always build your own. Though the ...

  4. ActiveMQ(5.10.0) - Spring Support

    Maven Dependency: <dependencies> <dependency> <groupId>org.apache.activemq</gro ...

  5. ActiveMQ(5.10.0) - Configuring the Simple Authentication Plug-in

    The easiest way to secure the broker is through the use of authentication credentials placed directl ...

  6. ActiveMQ(5.10.0) - 删除闲置的队列或主题

    方法一 通过 ActiveMQ Web 控制台删除. 方法二 通过 Java 代码删除. ActiveMQConnection.destroyDestination(ActiveMQDestinati ...

  7. ActiveMQ(5.10.0) - Message Redelivery and DLQ Handling

    When messages expire on the ActiveMQ broker (they exceed their time-to-live, if set) or can’t be red ...

  8. ActiveMQ(5.10.0) - hello world

    Sending a JMS message public class MyMessageProducer { ... // 创建连接工厂实例 ConnectionFactory connFactory ...

  9. ActiveMQ(5.10.0) - Destination-level authorization

    To build upon authentication, consider a use case requiring more fine-grained control over clients t ...

随机推荐

  1. Spring Data JPA教程, 第八部分:Adding Functionality to a Repository (未翻译)

    The previous part of my tutorial described how you can paginate query results with Spring Data JPA. ...

  2. Android子线程更新UI的方法总结

    版权声明:本文为博主原创文章,转载请注明出处:https://i.cnblogs.com/EditPosts.aspx?postid=6121280 消息机制,对于Android开发者来说,应该是非常 ...

  3. 【转】安装Intel HAXM为Android 模拟器加速,30秒内启动完成

    http://www.cnblogs.com/Li-Cheng/p/4351966.html http://www.cnblogs.com/csulennon/p/4178404.html https ...

  4. #定位系统性能瓶颈# strace &amp; ltrace

    strace和ltrace分别相应的是系统调用和库函数调用, 系统调用实际上就是指最底层的一个调用,在linux程序设计里面就是底层调用的意思,面向的是硬件. 而库函数调用则面向的是应用开发的.相当于 ...

  5. Java基础-新建项目、包和类

    1,新建项目

  6. 使用VS2012 开发SharePoint 2013 声明式的action(activity) 综合实例

    本文讲述使用VS2012 开发SharePoint 2013 声明式的action 综合实例. 需求同: http://blog.csdn.net/abrahamcheng/article/detai ...

  7. 实现经常使用的配置文件/初始化文件读取的一个C程序

    在编程中,我们常常会遇到一些配置文件或初始化文件. 这些文件通常后缀名为.ini或者.conf.能够直接用记事本打开.里面会存储一些程序參数,在程序中直接读取使用.比如,计算机与server通信.se ...

  8. Android4.4 蓝牙源码部分分析

    最近GOOGLE发布了Android4.4,看了一下源码:4.4的蓝牙打开流程这一部分还是有些变化的,从界面上看蓝牙开关就是设置settings里那个switch开关,widget开关当然也可以,起点 ...

  9. 个人对maven pom.xml文件的理解

    如:一个项目可能需要引用另外两个项目的类.. 如 项目cswebbefore  需要引用cswebservice 和reports 这三个项目都有各自的pom.xml文件 cswebservice 项 ...

  10. 【Android】利用服务Service创建标题栏通知

    创建标题栏通知的核心代码 public void CreateInform() { //定义一个PendingIntent,当用户点击通知时,跳转到某个Activity(也可以发送广播等) Inten ...