Skip to main content

NMS.ActiveMQ URI Configuration

Configuring NMS.ActiveMQ​

All configuration is achieved via URI-encoded parameters, either on the connection or destinations. Through the URIs, you can configure virtually every facet of your NMS.ActiveMQ client. The tables below show the comprehensive set of parameters.

Connection URI Parameters​


Example Configuration​

Using the Generic NMSConnectionFactory class would look as follows:

var cf = new NMSConnectionFactory("activemq:tcp://localhost:61616?wireFormat.tightEncodingEnabled=true");

You can also use the ActiveMQ ConecctionFactory implementation directory:

var cf = new Apache.NMS.ActiveMQ.ConnectionFactory("tcp://localhost:61616?wireFormat.tightEncodingEnabled=true");

Protocol Options​


OptionDescription
tcpUses TCP/IP Sockets to connect to the Broker.
sslUses TCP/IP Sockets to connect to the Broker with an added SSL layer.
discoveryUses The Discovery Transport to find a Broker
failoverUses the Failover Transport to connect and reconnect to one or more Brokers

Transport Options​


TCP Transport Options​

OptionDefaultDescription
transport.useLoggingfalseLog data that is sent across the Transport.
transport.receiveBufferSize8192Amount of Data to buffer from the Socket
transport.sendBufferSize8192Amount of Data to buffer before writing to the Socket
transport.receiveTimeout0Time to wait for more data, zero means wait infinitely
transport.sendTimeout0Timeout on sends, 0 means wait forever for completion
transport.requestTimeout0Time to wait before a Request Command is considered to have failed

Discovery Transport Options​

Failover Transport Options​

Prior to NMS.ActiveMQ v1.4.0 the failover transport options did not use the transport.* prefix.

OptionDefaultDescription
transport.timeout-1Time that a send operation blocks before failing.
transport.initialReconnectDelay10Time in Milliseconds that the transport waits before attempting to reconnect the first time.
transport.maxReconnectDelay30000The max time in Milliseconds that the transport will wait before attempting to reconnect.
transport.backOffMultiplier2The amount by which the reconnect delay will be multiplied by if useExponentialBackOff is enabled.
transport.useExponentialBackOfftrueShould the delay between connection attempt grow on each try up to the max reconnect delay.
transport.randomizetrueShould the Uri to connect to be chosen at random from the list of available Uris.
transport.maxReconnectAttempts0Maximum number of time the transport will attempt to reconnect before failing (0 means infinite retries)
transport.startupMaxReconnectAttempts0Maximum number of time the transport will attempt to reconnect before failing when there has never been a connection made. (0 means infinite retries) (included in NMS.ActiveMQ v1.5.0+)
transport.reconnectDelay10The delay in milliseconds that the transport waits before attempting a reconnection.
transport.backupfalseShould the Failover transport maintain hot backups.
transport.backupPoolSize1If enabled, how many hot backup connections are made.
transport.trackMessagesfalsekeep a cache of in-flight messages that will flushed to a broker on reconnect
transport.maxCacheSize256Number of messages that are cached if trackMessages is enabled.
transport.updateURIsSupportedtrueUpdate the list of known brokers based on BrokerInfo messages sent to the client.

Connection Options​


Connection options can either be set via the connection.* prefix or the nms.* prefix similar to the java client's jms.* prefix settings.

OptionDefaultDescription
connection.AsyncSendfalseAre message sent Asynchronously.
connection.AsyncClosetrueShould the close command be sent Asynchronously
connection.AlwaysSyncSendfalseCauses all messages a Producer sends to be sent Asynchronously.
connection.CopyMessageOnSendtrueCopies the Message objects a Producer sends so that the client can reuse Message objects without affecting an in-flight message.
connection.ProducerWindowSize0The ProducerWindowSize is the maximum number of bytes in memory that a producer will transmit to a broker before waiting for acknowledgement messages from the broker that it has accepted the previously sent messages. In other words, this how you configure the producer flow control window that is used for async sends where the client is responsible for managing memory usage. The default value of 0 means no flow control at the client. See also Producer Flow Control
connection.useCompressionfalseShould message bodies be compressed before being sent.
connection.sendAcksAsyncfalseShould message acks be sent asynchronously
connection.messagePrioritySupportedtrueShould messages be delivered to the client based on the value of the Message Priority header.
connection.dispatchAsyncfalseShould the broker dispatch messages asynchronously to the connection's consumers.
connection.watchTopicAdvisoriestrueShould the client watch for advisory messages from the broker to track the creation and deletion of temporary destinations.

OpenWire Options​

OptionDefaultDescription
wireFormat.stackTraceEnabledfalseShould the stack trace of exception that occur on the broker be sent to the client? Only used by openwire protocol.
wireFormat.cacheEnabledfalseShould commonly repeated values be cached so that less marshalling occurs? Only used by openwire protocol.
wireFormat.tcpNoDelayEnabledfalseDoes not affect the wire format, but provides a hint to the peer that TCP nodelay should be enabled on the communications Socket. Only used by openwire protocol.
wireFormat.sizePrefixDisabledfalseShould serialized messages include a payload length prefix? Only used by openwire protocol.
wireFormat.tightEncodingEnabledfalseShould wire size be optimized over CPU usage? Only used by the openwire protocol.
wireFormat.maxInactivityDuration30000The maximum inactivity duration (before which the socket is considered dead) in milliseconds. On some platforms it can take a long time for a socket to appear to die, so we allow the broker to kill connections if they are inactive for a period of time. Use by some transports to enable a keep alive heart beat feature. Set to a value <= 0 to disable inactivity monitoring.
maxInactivityDurationInitalDelay10000The initial delay in starting the maximum inactivity checks (and, yes, the word 'Inital' is supposed to be misspelled like that)

Destination URI Parameters​


Example Configuration​

d = session.CreateTopic("com.foo?consumer.prefetchSize=2000&consumer.noLocal=true");

General Options​


OptionDefaultDescription
consumer.prefetchSize1000The number of message the consumer will prefetch.  Removed in v1.7.0 use connection prefetch policy instead.
consumer.maximumPendingMessageLimit0Use to control if messages are dropped if a slow consumer situation exists.
consumer.noLocalfalseSame as the noLocal flag on a Topic consumer. Exposed here so that it can be used with a queue.
consumer.dispatchAsyncfalseShould the broker dispatch messages asynchronously to the consumer.
consumer.retroactivefalseIs this a Retroactive Consumer.
consumer.selectornullJMS Selector used with the consumer.
consumer.exclusivefalseIs this an Exclusive Consumer.
consumer.priority0Allows you to configure a Consumer Priority.

OpenWire-only Options​


OptionDefaultDescription
consumer.browserfalse
consumer.networkSubscriptionfalse
consumer.optimizedAcknowledgefalseEnables 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
consumer.noRangeAcksfalse
consumer.retroactivefalseSets 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.