ActiveMQ Artemis has a Command Line Interface (CLI) that can used to manage a few aspects of the broker like instance creation, basic user management, queue & address management, etc. This interface is designed for simple use-cases with humans in mind. It is not an exhaustive set of commands for complete broker management. There is a comprehensive management API available with many operations that return JSON formatted output which is better suited for use in scripts and other automated processes.

There are two ways the CLI can be used:

  • Traditional CLI commands, e.g.: ./artemis [COMMAND] [PARAMETERS]

  • A custom shell that is accesssed using the ./artemis or ./artemis shell commands.

All commands available through the traditional CLI commands are also available through the shell interface.

One benefit of the shell is that it will reuse some information as you repeat commands. For example, once you supply the broker URI and username & password to one command those values will be transparently applied other commands in the same shell session. Of course, the shell also allows you to avoid retyping ./artemis for every command.

1. Getting Help

You can get a complete list of available commands by typing:

  1. $ ./artemis help
  2. Usage: artemis [COMMAND]
  3. ActiveMQ Artemis Command Line
  4. Commands:
  5. help use 'help <command>' for more information
  6. auto-complete Generates the auto complete script file to be used in bash or
  7. zsh.
  8. shell JLine3 shell helping using the CLI
  9. producer Send message(s) to a broker.
  10. transfer Move messages from one destination towards another destination.
  11. consumer Consume messages from a queue.
  12. browser Browse messages on a queue.
  13. mask Mask a password and print it out.
  14. version Print version information.
  15. perf use 'help perf' for sub commands list
  16. check use 'help check' for sub commands list
  17. queue use 'help check' for sub commands list
  18. address use 'help address' for sub commands list
  19. data use 'help data' for sub commands list
  20. create Create a new broker instance.
  21. upgrade Update a broker instance to the current artemis.home, keeping
  22. all the data and broker.xml. Warning: backup your instance
  23. before using this command and compare the files.

It is also possible to use help at a specific command or sub-command for more information. For example, to get a list of sub-commands for data you type ./artemis help data:

  1. $ ./artemis help data
  2. Usage: artemis data [COMMAND]
  3. use 'help data' for sub commands list
  4. Commands:
  5. recover Recover (undelete) every message on the journal by creating a new
  6. output journal. Rolled back and acked messages will be sent out to
  7. the output as much as possible.
  8. print Print data records information. WARNING: don't use while a
  9. production server is running.
  10. exp Export all message-data using an XML that could be interpreted by
  11. any system.
  12. imp Import all message-data using an XML that could be interpreted by
  13. any system.
  14. decode Decode a journal's internal format into a new set of journal files.
  15. encode Encode a set of journal files into an internal encoded data format.
  16. compact Compact the journal of a non running server.

Or you can get help for a particular command. For example, ./artemis help create:

  1. Usage: artemis create [--aio] [--allow-anonymous] [--autocreate] [--autodelete]
  2. [--backup] [--blocking] [--clustered]
  3. [--disable-persistence] [--failover-on-shutdown]
  4. [--force] [--jdbc] [--linux] [--mapped] [--nio]
  5. [--no-amqp-acceptor] [--no-autocreate] [--no-autotune]
  6. [--no-fsync] [--no-hornetq-acceptor] [--no-mqtt-acceptor]
  7. [--no-stomp-acceptor] [--no-web] [--paging]
  8. [--relax-jolokia] [--replicated] [--require-login]
  9. [--shared-store] [--silent] [--slave]
  10. [--support-advisory]
  11. [--suppress-internal-management-objects]
  12. [--use-client-auth] [--verbose] [--windows]
  13. [--addresses=<addresses>]
  14. [--cluster-password=<clusterPassword>]
  15. [--cluster-user=<clusterUser>] [--data=<data>]
  16. [--default-port=<defaultPort>] [--encoding=<encoding>]
  17. [--etc=<etc>] [--global-max-messages=<globalMaxMessages>]
  18. [--global-max-size=<globalMaxSize>] [--home=<home>]
  19. [--host=<host>] [--http-host=<httpHost>]
  20. [--http-port=<httpPort>] [--java-memory=<javaMemory>]
  21. [--jdbc-bindings-table-name=<jdbcBindings>]
  22. [--jdbc-connection-url=<jdbcURL>]
  23. [--jdbc-driver-class-name=<jdbcClassName>]
  24. [--jdbc-large-message-table-name=<jdbcLargeMessages>]
  25. [--jdbc-lock-expiration=<jdbcLockExpiration>]
  26. [--jdbc-lock-renew-period=<jdbcLockRenewPeriod>]
  27. [--jdbc-message-table-name=<jdbcMessages>]
  28. [--jdbc-network-timeout=<jdbcNetworkTimeout>]
  29. [--jdbc-node-manager-table-name=<jdbcNodeManager>]
  30. [--jdbc-page-store-table-name=<jdbcPageStore>]
  31. [--journal-device-block-size=<journalDeviceBlockSize>]
  32. [--journal-retention=<retentionDays>]
  33. [--journal-retention-max-bytes=<retentionMaxBytes>]
  34. [--max-hops=<maxHops>]
  35. [--message-load-balancing=<messageLoadBalancing>]
  36. [--name=<name>] [--password=<password>] [--ping=<ping>]
  37. [--port-offset=<portOffset>] [--queues=<queues>]
  38. [--role=<role>] [--security-manager=<securityManager>]
  39. [--ssl-key=<sslKey>]
  40. [--ssl-key-password=<sslKeyPassword>]
  41. [--ssl-trust=<sslTrust>]
  42. [--ssl-trust-password=<sslTrustPassword>]
  43. [--staticCluster=<staticNode>] [--user=<user>]
  44. [--java-options=<javaOptions>]... <directory>
  45. Create a new broker instance.
  46. <directory> The instance directory to hold the broker's
  47. configuration and data. Path must be writable.
  48. --addresses=<addresses>
  49. A comma separated list of addresses with the
  50. option to specify a routing type, e.g.
  51. --addresses myAddress1,myAddress2:anycast.
  52. Routing-type default: multicast.
  53. --aio Set the journal as asyncio.
  54. --allow-anonymous Allow connections from users with no security
  55. credentials. Opposite of --require-login.
  56. Default: input.
  57. --autocreate Allow automatic creation of addresses & queues.
  58. Default: true.
  59. --autodelete Allow automatic deletion of addresses & queues.
  60. Default: false.
  61. --backup Be a backup broker. Valid for shared store or
  62. replication.
  63. --blocking Block producers when address becomes full.
  64. Opposite of --paging. Default: false.
  65. --cluster-password=<clusterPassword>
  66. The password to use for clustering. Default: input.
  67. --cluster-user=<clusterUser>
  68. The user to use for clustering. Default: input.
  69. --clustered Enable clustering.
  70. --data=<data> Directory where ActiveMQ data are stored. Paths
  71. can be absolute or relative to artemis.instance
  72. directory. Default: data.
  73. --default-port=<defaultPort>
  74. The port number to use for the main 'artemis'
  75. acceptor. Default: 61616.
  76. --disable-persistence Disable message persistence to the journal
  77. --encoding=<encoding> The encoding that text files should use. Default:
  78. UTF-8.
  79. --etc=<etc> Directory where ActiveMQ configuration is located.
  80. Paths can be absolute or relative to artemis.
  81. instance directory. Default: etc.
  82. --failover-on-shutdown Whether broker shutdown will trigger failover for
  83. clients using the core protocol. Valid only for
  84. shared store. Default: false.
  85. --force Overwrite configuration at destination directory.
  86. --global-max-messages=<globalMaxMessages>
  87. Maximum number of messages that will be accepted
  88. in memory before using address full policy mode.
  89. Default: undefined.
  90. --global-max-size=<globalMaxSize>
  91. Maximum amount of memory which message data may
  92. consume. Default: half of the JVM's max memory.
  93. --home=<home> Directory where ActiveMQ Artemis is installed.
  94. --host=<host> Broker's host name. Default: 0.0.0.0 or input if
  95. clustered).
  96. --http-host=<httpHost> Embedded web server's host name. Default:
  97. localhost.
  98. --http-port=<httpPort> Embedded web server's port. Default: 8161.
  99. --java-memory=<javaMemory>
  100. Define the -Xmx memory parameter for the broker.
  101. Default: 2G.
  102. --java-options=<javaOptions>
  103. Extra Java options to be passed to the profile.
  104. --jdbc Store message data in JDBC instead of local files.
  105. --jdbc-bindings-table-name=<jdbcBindings>
  106. Name of the jdbc bindings table.
  107. --jdbc-connection-url=<jdbcURL>
  108. The URL used for the database connection.
  109. --jdbc-driver-class-name=<jdbcClassName>
  110. JDBC driver classname.
  111. --jdbc-large-message-table-name=<jdbcLargeMessages>
  112. Name of the large messages table.
  113. --jdbc-lock-expiration=<jdbcLockExpiration>
  114. Lock expiration (in milliseconds).
  115. --jdbc-lock-renew-period=<jdbcLockRenewPeriod>
  116. Lock Renew Period (in milliseconds).
  117. --jdbc-message-table-name=<jdbcMessages>
  118. Name of the jdbc messages table.
  119. --jdbc-network-timeout=<jdbcNetworkTimeout>
  120. Network timeout (in milliseconds).
  121. --jdbc-node-manager-table-name=<jdbcNodeManager>
  122. Name of the jdbc node manager table.
  123. --jdbc-page-store-table-name=<jdbcPageStore>
  124. Name of the page store messages table.
  125. --journal-device-block-size=<journalDeviceBlockSize>
  126. The block size of the journal's storage device.
  127. Default: 4096.
  128. --journal-retention=<retentionDays>
  129. Configure journal retention in days. If > 0 then
  130. enable journal-retention-directory from broker.
  131. xml allowing replay options.
  132. --journal-retention-max-bytes=<retentionMaxBytes>
  133. Maximum number of bytes to keep in the retention
  134. directory.
  135. --linux, --cygwin Force Linux or Cygwin script creation. Default:
  136. based on your actual system.
  137. --mapped Set the journal as mapped.
  138. --max-hops=<maxHops> Number of hops on the cluster configuration.
  139. --message-load-balancing=<messageLoadBalancing>
  140. Message load balancing policy for cluster.
  141. Default: ON_DEMAND. Valid values: ON_DEMAND,
  142. STRICT, OFF, OFF_WITH_REDISTRIBUTION.
  143. --name=<name> The name of the broker. Default: same as host name.
  144. --nio Set the journal as nio.
  145. --no-amqp-acceptor Disable the AMQP specific acceptor.
  146. --no-autocreate Disable auto creation for addresses & queues.
  147. --no-autotune Disable auto tuning of the journal-buffer-timeout
  148. in broker.xml.
  149. --no-fsync Disable usage of fdatasync (channel.force(false)
  150. from Java NIO) on the journal.
  151. --no-hornetq-acceptor Disable the HornetQ specific acceptor.
  152. --no-mqtt-acceptor Disable the MQTT specific acceptor.
  153. --no-stomp-acceptor Disable the STOMP specific acceptor.
  154. --no-web Whether to omit the web-server definition from
  155. bootstrap.xml.
  156. --paging Page messages to disk when address becomes full.
  157. Opposite of --blocking. Default: true.
  158. --password=<password> The user's password. Default: input.
  159. --ping=<ping> A comma separated string to be passed on to the
  160. broker config as network-check-list. The broker
  161. will shutdown when all these addresses are
  162. unreachable.
  163. --port-offset=<portOffset>
  164. How much to off-set the ports of every acceptor.
  165. --queues=<queues> A comma separated list of queues with the option
  166. to specify a routing type, e.g. --queues
  167. myQueue1,myQueue2:multicast. Routing-type
  168. default: anycast.
  169. --relax-jolokia Disable strict checking in jolokia-access.xml.
  170. --replicated Enable broker replication.
  171. --require-login Require security credentials from users for
  172. connection. Opposite of --allow-anonymous.
  173. --role=<role> The name for the role created. Default: amq.
  174. --security-manager=<securityManager>
  175. Which security manager to use - jaas or basic.
  176. Default: jaas.
  177. --shared-store Enable broker shared store.
  178. --silent Disable all the inputs, and make a best guess for
  179. any required input.
  180. --slave Deprecated for removal. Use 'backup' instead.
  181. --ssl-key=<sslKey> Embedded web server's key store path.
  182. --ssl-key-password=<sslKeyPassword>
  183. The key store's password.
  184. --ssl-trust=<sslTrust> The trust store path in case of client
  185. authentication.
  186. --ssl-trust-password=<sslTrustPassword>
  187. The trust store's password.
  188. --staticCluster, --static-cluster=<staticNode>
  189. Cluster node connectors list separated by comma, e.
  190. g. "tcp://server:61616,tcp://server2:61616,tcp:
  191. //server3:61616".
  192. --support-advisory Support advisory messages for the OpenWire
  193. protocol.
  194. --suppress-internal-management-objects
  195. Do not register any advisory addresses/queues for
  196. the OpenWire protocol with the broker's
  197. management service.
  198. --use-client-auth Require client certificate authentication when
  199. connecting to the embedded web server.
  200. --user=<user> The username. Default: input.
  201. --verbose Print additional information.
  202. --windows Force Windows script creation. Default: based on
  203. your actual system.

2. Bash and Zsh auto complete

Bash and Zsh provide ways to auto-complete commands. To integrate with that functionality you have the option to generate the auto-complete script, i.e.:

  1. $ ./artemis auto-complete

This will generate a file named auto-complete-artemis.sh that can be installed using:

  1. $ source ./auto-complete-artemis.sh

After the auto-completion is installed you can view auto-completion information by pressing TAB:

  1. $ ./artemis
  2. activation browser create kill perf-journal run transfer version
  3. address check data mask producer shell upgrade
  4. auto-complete consumer help perf queue stop user

In order to see the various parameters available you must type -- then press TAB:

  1. $ ./artemis create --
  2. --addresses --jdbc-bindings-table-name --paging
  3. --aio --jdbc-connection-url --password
  4. --allow-anonymous --jdbc-driver-class-name --ping
  5. --autocreate --jdbc-large-message-table-name --port-offset
  6. --autodelete --jdbc-lock-expiration --queues
  7. --blocking --jdbc-lock-renew-period --relax-jolokia
  8. --cluster-password --jdbc-message-table-name --replicated
  9. --cluster-user --jdbc-network-timeout --require-login
  10. --clustered --jdbc-node-manager-table-name --role

3. Input required

Some functionality may require interactive user input if not explicitly provided through a parameter. For example, in cases like connecting to a broker or creating the broker instance:

  1. $ ./artemis queue stat
  2. Connection brokerURL = tcp://localhost:61616
  3. Connection failed::AMQ229031: Unable to validate user from /127.0.0.1:56320. Username: null; SSL certificate subject DN: unavailable
  4. --user:
  5. Type the username for a retry
  6. myUser
  7. --password: is mandatory with this configuration:
  8. Type the password for a retry

4. Artemis Shell

To initialize the shell session, type ./artemis shell (or just ./artemis if you prefer):

  1. $ ./artemis

The ActiveMQ Artemis shell provides an interface that can be used to execute commands directly without leaving the Java Virtual Machine.

  1. _ _ _
  2. / \ ____| |_ ___ __ __(_) _____
  3. / _ \| _ \ __|/ _ \ \/ | |/ __/
  4. / ___ \ | \/ |_/ __/ |\/| | |\___ \
  5. /_/ \_\| \__\____|_| |_|_|/___ /
  6. Apache ActiveMQ Artemis
  7. For a list of commands, type help or press <TAB>:
  8. Type exit or press <CTRL-D> to leave the session:
  9. Apache ActiveMQ Artemis >

4.1. Connecting Interactively

It is possible to authenticate your CLI client once to the server and reuse the connection information for additional commands:

  1. Apache ActiveMQ Artemis > connect --user=myUser --password=myPass --url tcp://localhost:61616
  2. Connection brokerURL = tcp://localhost:61616
  3. Connection Successful!

Now any command requiring authentication will reuse these parameters.

For example the sub-command queue stat will reuse previous information to perform its connection to the broker.

  1. Apache ActiveMQ Artemis > queue stat
  2. Connection brokerURL = tcp://localhost:61616
  3. |NAME |ADDRESS |CONSUMER_COUNT|MESSAGE_COUNT|MESSAGES_ADDED|DELIVERING_COUNT|MESSAGES_ACKED|SCHEDULED_COUNT|ROUTING_TYPE|
  4. |DLQ |DLQ |0 |0 |0 |0 |0 |0 |ANYCAST |
  5. |ExpiryQueue |ExpiryQueue |0 |0 |0 |0 |0 |0 |ANYCAST |
  6. |Order |Order |0 |4347 |4347 |0 |0 |0 |ANYCAST |
  7. |activemq.management.0b...|activemq.management.0b...|1 |0 |0 |0 |0 |0 |MULTICAST |

4.2. Connecting Statically

It is possible to start the shell with an initial connection configured statically, e.g.:

  1. $ ./artemis shell --user <username> --password <password> --url tcp://<hostname>:<port>

The CLI should not ask for a the broker URL or user/password for any further commands, e.g.:

  1. $ ./artemis shell --user myUser --password myPass
  2. ...
  3. Apache ActiveMQ Artemis > queue stat
  4. Connection brokerURL = tcp://localhost:61616
  5. |NAME |ADDRESS |CONSUMER_COUNT|MESSAGE_COUNT|MESSAGES_ADDED|DELIVERING_COUNT|MESSAGES_ACKED|SCHEDULED_COUNT|ROUTING_TYPE|
  6. |DLQ |DLQ |0 |0 |0 |0 |0 |0 |ANYCAST |
  7. |ExpiryQueue |ExpiryQueue |0 |0 |0 |0 |0 |0 |ANYCAST |
  8. |TEST |TEST |0 |8743 |8743 |0 |0 |0 |ANYCAST |
  9. |activemq.management.2a...|activemq.management.2a...|1 |0 |0 |0 |0 |0 |MULTICAST |