ActiveMQ Configuration
In this second tutorial about ActiveMQ we will learn its basic configuration.
The broker configuration is named activemq.xml and it’s contained into the conf folder of your ActiveMQ installation. The most interesting part is the the Transport connectors which are used to expose ActiveMQ using a variety of protocols:
<transportConnectors>
<transportConnector name="openwire" uri="tcp://0.0.0.0:61616?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
<transportConnector name="amqp" uri="amqp://0.0.0.0:5672?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
<transportConnector name="stomp" uri="stomp://0.0.0.0:61613?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
<transportConnector name="mqtt" uri="mqtt://0.0.0.0:1883?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
<transportConnector name="ws" uri="ws://0.0.0.0:61614?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
</transportConnectors>
So, for example if you want to reach ActiveMQ from a remote JMS client, you have to use the tcp://0.0.0.0:61616 channel.
Alternate startup configuration
If you don’t want to change the default configuration, then you can apply startup settings to your Broker configuration URI as follows:
The URI is assumed to be a composite uri with multiple uris that are used to bind the connectors of the broker.
broker:(transportURI,network:networkURI)/brokerName?brokerOptions
If a composite URI use the network: scheme, then the rest of the URI is bound as a network connector.
The following example starts up a broker accepting connections on port 41616, and establishes a network connection to mymachine:61616 and disables persistence.
C:\apache-activemq-5.10.0\bin>activemq.bat start broker:(tcp://localhost:41616,network:static:tcp://mymachine:61616)?persistent=false&useJmx=true
Another way to customize the startup of ActiveMQ is the Broker XBean URI. the Broker XBean URI runs a specifically configured broker by referencing an XML configuration file on the classpath or external URL. The following example starts up a broker using the activemq.xml configuration file which is in the current directory:
C:\apache-activemq-5.10.0\bin>activemq.bat start xbean:file:./activemq.xml
The default activemq.xml provides a sample format for a configuration file.
Recommended Articles
Mastering MQTT Connectivity with Artemis Broker - A Step-by-Step Java Tutorial
Learn how to use MQTT protocol with Artemis broker in this comprehensive Java tutorial. #MQTT #ArtemisBroker #JavaTutorials
Install and Run Your First ActiveMQ with Ease - A Comprehensive Guide
Learn how to install and run your first ActiveMQ instance. Disambiguate ActiveMQ vs Artemis MQ. #ActiveMQ #Java #Middleware #CloudNative
Second Tutorial: Integrating WildFly with Apache ActiveMQ Broker Using Resource Adapter
Learn how to deploy an ActiveMQ resource adapter as a module in WildFly and configure connections, queues. Prerequisites: JBoss EAP 6.1+/Wildfly.
Setting Up ActiveMQ Artemis: A Step-by-Step Guide
Learn how to install and start ActiveMQ Artemis, a message broker that retains compatibility with HornetQ while adding many interesting features.