ActiveMQ
This page explains how to configure Apache ActiveMQ connection settings.
The picture below shows the ActiveMQ settings:
The fields used for ActiveMQ configuration are shown in the table below.
Field | Description |
---|---|
Enabled | Indicates the active state of the setting. |
Name | The name of the setting to be made. |
Description | Description can be entered. |
ActiveMQ Connection Protocol Type | It is used to select whether to connect to ActiveMQ with the AMQP protocol or the TCP protocol. |
Broker Url | The target connection URL where ActiveMQ is installed. |
Username | It is the username information required to connect to ActiveMQ. |
Password | It is the password information required to connect to ActiveMQ. |
Destination Type | Used to select whether the target is a Queue or Topic. |
Destination Name | If Target is Queue this is the queue name, else it is the topic name. |
Session Acknowledgement | Specifies how Session Confirmation should be done. |
Client ID | It is used to set the JMS clientId value in connections. |
Send Timeout | It is used to set the send timeout value. |
Request Timeout | If protocol type is AMQP, It is used to set the request timeout value. Otherwise, "requestTimeout" parameter value must be added to Broker URL |
Close Timeout | It is used to control how long a Connection close will wait for clean shutdown of the connection before giving up. A negative value means wait forever. |
Connect Timeout | If protocol type is AMQP, this value is used to control how long a client will wait for a successful connection to the remote peer to be established before considering the attempt to have failed. Otherwise, "connectTimeout" parameter value must be added to Broker URL |
Content Type | It is used to set the contentType value of the data to be sent. |
Content Encoding | It is used to set the contentEncoding value of the data to be sent. |
Broker URL Examples
AMQP URL Examples
Scenario | URL Example | Description |
---|---|---|
Simple Connection | amqp://localhost:5672 | Basic AMQP connection |
With Authentication | amqp://user:password@localhost:5672 | Connection with username and password |
SSL/TLS | amqps://secure-broker.example.com:5671 | Secure AMQP connection |
Multiple Brokers | amqp://broker1:5672,amqp://broker2:5672 | Connection to multiple brokers |
With Timeouts | amqp://localhost:5672?transport.connectTimeout=30000&transport.requestTimeout=30000 | Connection with timeout settings |
SSL with Failover | amqps://broker:5671?transport.trustStoreLocation=/path/truststore.jks&failover.maxReconnectAttempts=5 | SSL and reconnection configured |
With Prefetch | amqp://broker:5672?jms.prefetchPolicy.all=1000 | Connection with message prefetch |
Many Features | amqp://broker:5672?jms.prefetchPolicy.all=1000&amqp.idleTimeout=30000&transport.connectTimeout=30000 | Many features configured |
TCP URL Examples
Scenario | URL Example | Description |
---|---|---|
Simple Connection | tcp://localhost:61616 | Basic TCP connection |
With Authentication | tcp://user:password@localhost:61616 | Connection with username and password |
With Timeouts | tcp://localhost:61616?soTimeout=30000&soWriteTimeout=30000 | Connection with timeout settings |
Basic Failover | failover:(tcp://broker1:61616,tcp://broker2:61616) | Basic failover configuration |
With SSL | ssl://secure-broker:61617?needClientAuth=true&keyStore=/path/keystore.jks | Connection with SSL certificate |
Performance Optimized | tcp://localhost:61616?tcpNoDelay=true&socketBufferSize=65536 | Optimized for performance |
High Availability | failover:(tcp://primary:61616,tcp://backup:61616)?maxReconnectAttempts=-1 | Configured for high availability |
Full Failover | failover:(tcp://broker1:61616,tcp://broker2:61616)?initialReconnectDelay=1000&maxReconnectDelay=30000&maxReconnectAttempts=5 | Detailed failover settings |
Production Ready | failover:(tcp://prod1:61616,tcp://prod2:61616)?randomize=true&priorityBackup=true&useExponentialBackOff=true | Optimized for production |
Important Parameters and Values
Parameter Type | Parameter | Example Value | Description |
---|---|---|---|
Timeout | soTimeout | 30000 | Socket read timeout (ms) |
Timeout | soWriteTimeout | 30000 | Socket write timeout (ms) |
Failover | maxReconnectAttempts | 5 | Maximum reconnection attempts |
Failover | initialReconnectDelay | 1000 | Initial connection delay (ms) |
Performance | tcpNoDelay | true | Disable TCP Nagle algorithm |
Performance | socketBufferSize | 65536 | Socket buffer size (bytes) |
Prefetch | jms.prefetchPolicy.queuePrefetch | 1000 | Queue prefetch count |
Prefetch | jms.prefetchPolicy.topicPrefetch | 1000 | Topic prefetch count |
SSL | needClientAuth | true | Client certificate required |
SSL | verifyHost | true | Host verification enabled |
Common Use Case Scenarios
Scenario | Protocol | Recommended URL |
---|---|---|
Development | AMQP | amqp://localhost:5672 |
Development | TCP | tcp://localhost:61616 |
Testing | AMQP | failover:(amqp://test1:5672,amqp://test2:5672)?failover.maxReconnectAttempts=3 |
Testing | TCP | failover:(tcp://test1:61616,tcp://test2:61616)?maxReconnectAttempts=3 |
Production | AMQP | amqps://prod:5671?transport.trustStoreLocation=/certs/truststore.jks&failover.maxReconnectAttempts=-1 |
Production | TCP | failover:(tcp://prod1:61616,tcp://prod2:61616)?randomize=true&maxReconnectAttempts=-1 |
High Security | AMQP | amqps://secure:5671?transport.verifyHost=true&transport.trustStoreLocation=/certs/truststore.jks |
High Security | TCP | ssl://secure:61617?needClientAuth=true&keyStore=/certs/keystore.jks |
High Performance | AMQP | amqp://fast:5672?jms.prefetchPolicy.all=2000&amqp.maxFrameSize=1048576 |
High Performance | TCP | tcp://fast:61616?tcpNoDelay=true&socketBufferSize=131072&wireFormat.maxFrameSize=104857600 |
Additional Connection Parameters
Category | Parameter | Value | Purpose |
---|---|---|---|
Wire Format | maxFrameSize | 104857600 | Maximum message frame size |
Wire Format | cacheEnabled | true | Enable wire format caching |
Reliability | useAsyncSend | true | Enable asynchronous sending |
Reliability | alwaysSyncSend | false | Disable synchronous sending |
Network | keepAlive | true | Enable TCP keep-alive |
Security | verifyHostName | true | Enable hostname verification |
Optimization | optimizeAcknowledge | true | Enable acknowledgment optimization |
Optimization | optimizedMessageDispatch | true | Enable message dispatch optimization |