layout: default_md title: Connection Configuration URI title-class: page-title-activemq5 type: activemq5

Using ActiveMQ > Configuring Transports > ActiveMQ Connection URIs > Connection Configuration URI

Connection Configuration URI

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

Use the Correct Prefix!

The following options should be prefixed with jms. when used on a brokerURL or a broker's transport connector.

Option NameDefault ValueDescription
alwaysSessionAsynctrueWhen true a separate thread is used for dispatching messages for each Session in the Connection. A separate thread is always used when there‘s more than one session, or the session isn’t in Session.AUTO_ACKNOWLEDGE or Session.DUPS_OK_ACKNOWLEDGE mode.
alwaysSyncSendfalseWhen trueMessageProducer will always use Sync sends when sending a Message even if it is not required for the Delivery Mode.
auditDepth2048The size of the message window that will be audited for duplicates and out of order messages.
auditMaximumProducerNumber64Maximum number of producers that will be audited.
checkForDuplicatestrueWhen true the consumer will check for duplicate messages and properly handle the message to make sure that it is not processed twice inadvertently.
clientIDnullSets the JMS clientID to use for the connection.
closeTimeout15000Sets the timeout, in milliseconds, before a close is considered complete. Normally a close() on a connection waits for confirmation from the broker. This allows the close operation to timeout preventing the client from hanging when no broker is available.
consumerExpiryCheckEnabledtrueControls 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).
copyMessageOnSendtrueShould 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. For a performance boost set to false if you do not mutate JMS messages after they are sent.
disableTimeStampsByDefaultfalseSets whether or not timestamps on messages should be disabled or not. For a small performance boost set to false.
dispatchAsyncfalseShould the broker dispatch messages asynchronously to the consumer?
nestedMapAndListEnabledtrueControls whether Structured Message Properties and MapMessages are supported so that Message properties and MapMessage entries can contain nested Map and List objects. Available from version 4.1.
objectMessageSerializationDeferedfalseWhen an object is set on an ObjectMessage the JMS spec requires the object be serialized by that set method. When true the object will not be serialized. The object may subsequently be serialized if the message needs to be sent over a socket or stored to disk.
optimizeAcknowledgefalseEnables an optimized 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.
optimizeAcknowledgeTimeOut300If > 0, specifies the max time, in milliseconds, between batch acknowledgements when optimizeAcknowledge is enabled. (since 5.6).
optimizedAckScheduledAckInterval0If > 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 un-ACK’ed messages (since 5.7).
optimizedMessageDispatchtrueIf true a larger prefetch limit is used - only applicable for durable topic subscribers.
useAsyncSendfalseForces 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.
useCompressionfalseEnables the use of compression on the message's body.
useRetroactiveConsumerfalseSets 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.
warnAboutUnstartedConnectionTimeout500The timeout, in milliseconds, from the time of 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.

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 NameObject configuredSee Also
jms.blobTransferPolicy.*BlobTransferPolicyBlob Message
jms.prefetchPolicy.*ActiveMQPrefetchPolicyWhat is the Prefetch Limit For?
jms.redeliveryPolicy.*RedeliveryPolicyRedelivery Policy

For example you could set

tcp://localhost:61616?jms.prefetchPolicy.all=100&jms.redeliveryPolicy.maximumRedeliveries=5