外观
ActiveMQ Classic 运维与观测
本页结论:Classic 的运维入口是 Web 控制台(8161 jetty,默认 admin/admin)、JMX 与统一 CLI 入口
bin/activemq(task 制);积压观察的核心是队列深度与 Enqueue/Dequeue 计数差,共享死信 ActiveMQ.DLQ 的深度必须配告警。
运维入口
| 入口 | 用途 |
|---|---|
| Web 控制台(8161,jetty) | Queue/Topic 浏览与清空、发送测试消息、查看连接与消费者;默认凭据 admin/admin,生产必改 |
| JMX | 全部管理属性/操作:深度、入队/出队计数、消息移动/删除(managementContext 配置) |
bin/activemq 统一入口 | task 制:start/stop/status、producer/consumer(收发工具)、browse/purge、bstat/dstat/query/list、backup/export、encrypt/decrypt 等(task 清单实测见 cli-tools 小节) |
| 客户端探针 | 本仓库 stats 命令用 QueueBrowser 清点深度(客户端视角,不依赖容器内 CLI) |
关键指标
| 指标 | 含义 | 告警建议 |
|---|---|---|
| QueueSize(队列深度) | 未消费消息数(QueueBrowser/JMX 可读数) | 持续增长 = 消费能力不足 |
| EnqueueCount / DequeueCount | 入队 / 出队累计 | 差值持续扩大 = 消费失败或积压 |
| ActiveMQ.DLQ 深度 | 全 broker 共享死信的消息数 | 非零即告警:毒消息或系统性失败;无法区分业务线(见 陷阱) |
| memory/store 使用率 | systemUsage 占用 | 接近限额 = 即将触发 producer flow control |
| 连接数 / 消费者数 | 会话与消费者分布 | 消费者掉线检测(结合业务心跳) |
积压诊断路径
- 哪个队列积压:控制台 Queues 页或 JMX 按深度排序;
- 消费者在不在:消费者数为 0 → 连接/部署问题;有消费者但深度涨 → 看处理耗时与失败率;
- 是否在重投风暴:
consume_failed类日志 + 出队计数增速远超业务增速 → 检查 redeliveryPolicy 的 maximumRedeliveries 与间隔; - 流控了吗:store 使用率触顶后生产者被减速,追赶速度下降是预期行为,先扩消费者再谈扩容。
日常操作速查
bash
# 容器内统一入口(ACTIVEMQ_HOME=/opt/apache-activemq)
bin/activemq status # 实测输出:ActiveMQ is running (pid '1')
bin/activemq producer --destination queue://orders-cli --messageCount 1 --message probe
bin/activemq consumer --destination queue://orders-cli --messageCount 1- 其余 task(browse/purge/bstat/dstat/query/backup/export 等)的用途见 cli-tools 小节的实测 task 清单;各 task 参数用
bin/activemq <task> -h查询。 - 修改 activemq.xml(destinationPolicy、认证插件等)需重启 broker 生效;变更前评估在途消息影响。
- 升级遵循官方迁移说明;KahaDB 数据目录先备份。
与其它产品对照
| 维度 | Classic | RabbitMQ | Artemis |
|---|---|---|---|
| 控制台 | jetty(8161,admin/admin) | management(15672) | hawtio(8161) |
| 积压指标 | QueueSize + Enqueue/Dequeue | queue depth + unacked | 队列 MessageCount |
| DLQ 观察 | 共享 ActiveMQ.DLQ 深度 | 死信队列深度 | 死信地址深度 |
边界
QueueBrowser深度是瞬时快照,高吞吐下与 JMX 计数可能有毫秒级差异,趋势比单点值重要。- 默认配置下 61616 匿名可连、控制台 admin/admin——观测能力不设防,安全基线必须先于生产上线(见 陷阱与检查表)。
cli-tools:纯自带 CLI 实验
6.2.0 镜像的 bin 目录仅 7 项(activemq 统一入口、activemq-diag、activemq.jar、setenv、wrapper.jar、linux-x86-64、macosx),统一入口为 task 制:producer/consumer 子命令即可完成收发闭环,status 查运行状态(实测输出 ActiveMQ is running (pid '1'))。Classic 没有显式建队命令:向全新队列 orders-cli 首次生产即自动创建。OpenWire 默认匿名,命令无需 user/password 参数(区别于 Artemis 镜像的 security-enabled=true);--message 只能固定内容,run.sh 循环 3 次各发 1 条。自带 consumer 没有 receive-timeout 参数,空队列时 consumer --messageCount 1 无限阻塞,实验用 timeout 15 包裹并断言 exit=124 证明队列已排空。
activemq-classic / docker
bash demos/activemq-classic/docker/run.shassert.out.txt
--- status: verified capturedAt: "2026-08-23T15:19:49.324Z" dockerImage: "apache/activemq-classic:6.2.0@sha256:992bc29a8459f6772ff14d168a8b011c9cde7a769ec01d72788c9cc4e9229564" exitCode: 0 --- PASS binCount: 7 PASS statusRunning: 1 PASS producedCount: 3 PASS consumedCount: 3 PASS consumedSummary: 1 PASS verifyExit: 124 PASS verifyReceived: 0 RESULT: all assertions passed
bin-list.out.txt
[cli-tools] $ sh -c ls /opt/apache-activemq/bin && /opt/apache-activemq/bin/activemq version
activemq
activemq-diag
activemq.jar
linux-x86-64
macosx
setenv
wrapper.jar
INFO: Loading '/opt/apache-activemq/bin/setenv'
INFO: Using java '/opt/java/openjdk/bin/java'
Java Runtime: Eclipse Adoptium 17.0.17 /opt/java/openjdk
Heap sizes: current=67584k free=65684k max=1048576k
JVM args: -Xms64M -Xmx1G -Djava.util.logging.config.file=logging.properties -Djava.security.auth.login.config=/opt/apache-activemq/conf/login.config -Djetty.host=0.0.0.0 --add-reads=java.xml=java.logging --add-opens=java.base/java.security=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.naming/javax.naming.spi=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.base/sun.nio.ch=ALL-UNNAMED --add-exports=java.base/sun.net.www.protocol.http=ALL-UNNAMED --add-exports=java.base/sun.net.www.protocol.https=ALL-UNNAMED --add-exports=java.base/sun.net.www.protocol.jar=ALL-UNNAMED --add-exports=jdk.xml.dom/org.w3c.dom.html=ALL-UNNAMED --add-exports=jdk.naming.rmi/com.sun.jndi.url.rmi=ALL-UNNAMED -Dactivemq.classpath=/opt/apache-activemq/conf: -Dactivemq.home=/opt/apache-activemq -Dactivemq.base=/opt/apache-activemq -Dactivemq.conf=/opt/apache-activemq/conf -Dactivemq.data=/opt/apache-activemq/data -Djolokia.conf=file:/opt/apache-activemq/conf/jolokia-access.xml
Extensions classpath:
[/opt/apache-activemq/lib,/opt/apache-activemq/lib/camel,/opt/apache-activemq/lib/optional,/opt/apache-activemq/lib/web,/opt/apache-activemq/lib/extra]
ACTIVEMQ_HOME: /opt/apache-activemq
ACTIVEMQ_BASE: /opt/apache-activemq
ACTIVEMQ_CONF: /opt/apache-activemq/conf
ACTIVEMQ_DATA: /opt/apache-activemq/data
Usage: Main [--extdir <dir>] [task] [task-options] [task data]
Tasks:
backup - Backup a message (or range) from a queue to an archive file
browse - Display selected messages in a specified destination.
bstat - Performs a predefined query that displays useful statistics regarding the specified broker
consumer - Receives messages from the broker
create - Creates a runnable broker instance in the specified path.
decrypt - Decrypts given text
dstat - Performs a predefined query that displays useful tabular statistics regarding the specified destination type
encrypt - Encrypts given text
export - Exports a stopped brokers data files to an archive file
list - Lists all available brokers in the specified JMX context
producer - Sends messages to the broker
purge - Delete selected destination's messages that matches the message selector
query - Display selected broker component's attributes and statistics.
start - Creates and starts a broker using a configuration file, or a broker URI.
stop - Stops a running broker specified by the broker name.
Task Options (Options specific to each task):
--extdir <dir> - Add the jar files in the directory to the classpath.
--version - Display the version information.
-h,-?,--help - Display this help information. To display task specific help, use Main [task] -h,-?,--help
Task Data:
- Information needed by each specific task.
JMX system property options:
-Dactivemq.jmx.url=<jmx service uri> (default is: 'service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi')
-Dactivemq.jmx.user=<user name>
-Dactivemq.jmx.password=<password>
consume.out.txt
[cli-tools] $ /opt/apache-activemq/bin/activemq consumer --destination queue://orders-cli --messageCount 3
INFO: Loading '/opt/apache-activemq/bin/setenv'
INFO: Using java '/opt/java/openjdk/bin/java'
Java Runtime: Eclipse Adoptium 17.0.17 /opt/java/openjdk
Heap sizes: current=67584k free=65684k max=1048576k
JVM args: -Xms64M -Xmx1G -Djava.util.logging.config.file=logging.properties -Djava.security.auth.login.config=/opt/apache-activemq/conf/login.config -Djetty.host=0.0.0.0 --add-reads=java.xml=java.logging --add-opens=java.base/java.security=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.naming/javax.naming.spi=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.base/sun.nio.ch=ALL-UNNAMED --add-exports=java.base/sun.net.www.protocol.http=ALL-UNNAMED --add-exports=java.base/sun.net.www.protocol.https=ALL-UNNAMED --add-exports=java.base/sun.net.www.protocol.jar=ALL-UNNAMED --add-exports=jdk.xml.dom/org.w3c.dom.html=ALL-UNNAMED --add-exports=jdk.naming.rmi/com.sun.jndi.url.rmi=ALL-UNNAMED -Dactivemq.classpath=/opt/apache-activemq/conf: -Dactivemq.home=/opt/apache-activemq -Dactivemq.base=/opt/apache-activemq -Dactivemq.conf=/opt/apache-activemq/conf -Dactivemq.data=/opt/apache-activemq/data -Djolokia.conf=file:/opt/apache-activemq/conf/jolokia-access.xml
Extensions classpath:
[/opt/apache-activemq/lib,/opt/apache-activemq/lib/camel,/opt/apache-activemq/lib/optional,/opt/apache-activemq/lib/web,/opt/apache-activemq/lib/extra]
ACTIVEMQ_HOME: /opt/apache-activemq
ACTIVEMQ_BASE: /opt/apache-activemq
ACTIVEMQ_CONF: /opt/apache-activemq/conf
ACTIVEMQ_DATA: /opt/apache-activemq/data
INFO | Connecting to URL: failover://tcp://localhost:61616 as user: null
INFO | Consuming queue://orders-cli
INFO | Sleeping between receives 0 ms
INFO | Running 1 parallel threads
INFO | Successfully connected to tcp://localhost:61616
INFO | consumer-1 wait until 3 messages are consumed
INFO | consumer-1 Received order-cli-1
INFO | consumer-1 Received order-cli-2
INFO | consumer-1 Received order-cli-3
INFO | consumer-1 Consumed: 3 messages
INFO | consumer-1 Consumer thread finished
create.out.txt
[cli-tools] $ /opt/apache-activemq/bin/activemq producer --destination queue://orders-cli --messageCount 1 --message order-cli-1
INFO: Loading '/opt/apache-activemq/bin/setenv'
INFO: Using java '/opt/java/openjdk/bin/java'
Java Runtime: Eclipse Adoptium 17.0.17 /opt/java/openjdk
Heap sizes: current=67584k free=65684k max=1048576k
JVM args: -Xms64M -Xmx1G -Djava.util.logging.config.file=logging.properties -Djava.security.auth.login.config=/opt/apache-activemq/conf/login.config -Djetty.host=0.0.0.0 --add-reads=java.xml=java.logging --add-opens=java.base/java.security=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.naming/javax.naming.spi=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.base/sun.nio.ch=ALL-UNNAMED --add-exports=java.base/sun.net.www.protocol.http=ALL-UNNAMED --add-exports=java.base/sun.net.www.protocol.https=ALL-UNNAMED --add-exports=java.base/sun.net.www.protocol.jar=ALL-UNNAMED --add-exports=jdk.xml.dom/org.w3c.dom.html=ALL-UNNAMED --add-exports=jdk.naming.rmi/com.sun.jndi.url.rmi=ALL-UNNAMED -Dactivemq.classpath=/opt/apache-activemq/conf: -Dactivemq.home=/opt/apache-activemq -Dactivemq.base=/opt/apache-activemq -Dactivemq.conf=/opt/apache-activemq/conf -Dactivemq.data=/opt/apache-activemq/data -Djolokia.conf=file:/opt/apache-activemq/conf/jolokia-access.xml
Extensions classpath:
[/opt/apache-activemq/lib,/opt/apache-activemq/lib/camel,/opt/apache-activemq/lib/optional,/opt/apache-activemq/lib/web,/opt/apache-activemq/lib/extra]
ACTIVEMQ_HOME: /opt/apache-activemq
ACTIVEMQ_BASE: /opt/apache-activemq
ACTIVEMQ_CONF: /opt/apache-activemq/conf
ACTIVEMQ_DATA: /opt/apache-activemq/data
INFO | Connecting to URL: failover://tcp://localhost:61616 as user: null
INFO | Producing messages to queue://orders-cli
INFO | Using persistent messages
INFO | Sleeping between sends 0 ms
INFO | Running 1 parallel threads
INFO | Successfully connected to tcp://localhost:61616
INFO | producer-1 Started to calculate elapsed time ...
INFO | producer-1 Produced: 1 messages
INFO | producer-1 Elapsed time in second : 0 s
INFO | producer-1 Elapsed time in milli second : 18 milli seconds
inventory.out.txt
---
status: verified
capturedAt: "2026-08-23T15:19:49.324Z"
dockerImage: "apache/activemq-classic:6.2.0@sha256:992bc29a8459f6772ff14d168a8b011c9cde7a769ec01d72788c9cc4e9229564"
exitCode: 0
---
[cli-tools] $ sh -c ls /opt/apache-activemq/bin && /opt/apache-activemq/bin/activemq version
activemq
activemq-diag
activemq.jar
linux-x86-64
macosx
setenv
wrapper.jar
INFO: Loading '/opt/apache-activemq/bin/setenv'
INFO: Using java '/opt/java/openjdk/bin/java'
Java Runtime: Eclipse Adoptium 17.0.17 /opt/java/openjdk
Heap sizes: current=67584k free=65684k max=1048576k
JVM args: -Xms64M -Xmx1G -Djava.util.logging.config.file=logging.properties -Djava.security.auth.login.config=/opt/apache-activemq/conf/login.config -Djetty.host=0.0.0.0 --add-reads=java.xml=java.logging --add-opens=java.base/java.security=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.naming/javax.naming.spi=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.base/sun.nio.ch=ALL-UNNAMED --add-exports=java.base/sun.net.www.protocol.http=ALL-UNNAMED --add-exports=java.base/sun.net.www.protocol.https=ALL-UNNAMED --add-exports=java.base/sun.net.www.protocol.jar=ALL-UNNAMED --add-exports=jdk.xml.dom/org.w3c.dom.html=ALL-UNNAMED --add-exports=jdk.naming.rmi/com.sun.jndi.url.rmi=ALL-UNNAMED -Dactivemq.classpath=/opt/apache-activemq/conf: -Dactivemq.home=/opt/apache-activemq -Dactivemq.base=/opt/apache-activemq -Dactivemq.conf=/opt/apache-activemq/conf -Dactivemq.data=/opt/apache-activemq/data -Djolokia.conf=file:/opt/apache-activemq/conf/jolokia-access.xml
Extensions classpath:
[/opt/apache-activemq/lib,/opt/apache-activemq/lib/camel,/opt/apache-activemq/lib/optional,/opt/apache-activemq/lib/web,/opt/apache-activemq/lib/extra]
ACTIVEMQ_HOME: /opt/apache-activemq
ACTIVEMQ_BASE: /opt/apache-activemq
ACTIVEMQ_CONF: /opt/apache-activemq/conf
ACTIVEMQ_DATA: /opt/apache-activemq/data
Usage: Main [--extdir <dir>] [task] [task-options] [task data]
Tasks:
backup - Backup a message (or range) from a queue to an archive file
browse - Display selected messages in a specified destination.
bstat - Performs a predefined query that displays useful statistics regarding the specified broker
consumer - Receives messages from the broker
create - Creates a runnable broker instance in the specified path.
decrypt - Decrypts given text
dstat - Performs a predefined query that displays useful tabular statistics regarding the specified destination type
encrypt - Encrypts given text
export - Exports a stopped brokers data files to an archive file
list - Lists all available brokers in the specified JMX context
producer - Sends messages to the broker
purge - Delete selected destination's messages that matches the message selector
query - Display selected broker component's attributes and statistics.
start - Creates and starts a broker using a configuration file, or a broker URI.
stop - Stops a running broker specified by the broker name.
Task Options (Options specific to each task):
--extdir <dir> - Add the jar files in the directory to the classpath.
--version - Display the version information.
-h,-?,--help - Display this help information. To display task specific help, use Main [task] -h,-?,--help
Task Data:
- Information needed by each specific task.
JMX system property options:
-Dactivemq.jmx.url=<jmx service uri> (default is: 'service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi')
-Dactivemq.jmx.user=<user name>
-Dactivemq.jmx.password=<password>
produce.out.txt
[cli-tools] $ for i in 2 3: /opt/apache-activemq/bin/activemq producer --destination queue://orders-cli --messageCount 1 --message order-cli-$i ...
INFO: Loading '/opt/apache-activemq/bin/setenv'
INFO: Using java '/opt/java/openjdk/bin/java'
Java Runtime: Eclipse Adoptium 17.0.17 /opt/java/openjdk
Heap sizes: current=67584k free=65909k max=1048576k
JVM args: -Xms64M -Xmx1G -Djava.util.logging.config.file=logging.properties -Djava.security.auth.login.config=/opt/apache-activemq/conf/login.config -Djetty.host=0.0.0.0 --add-reads=java.xml=java.logging --add-opens=java.base/java.security=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.naming/javax.naming.spi=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.base/sun.nio.ch=ALL-UNNAMED --add-exports=java.base/sun.net.www.protocol.http=ALL-UNNAMED --add-exports=java.base/sun.net.www.protocol.https=ALL-UNNAMED --add-exports=java.base/sun.net.www.protocol.jar=ALL-UNNAMED --add-exports=jdk.xml.dom/org.w3c.dom.html=ALL-UNNAMED --add-exports=jdk.naming.rmi/com.sun.jndi.url.rmi=ALL-UNNAMED -Dactivemq.classpath=/opt/apache-activemq/conf: -Dactivemq.home=/opt/apache-activemq -Dactivemq.base=/opt/apache-activemq -Dactivemq.conf=/opt/apache-activemq/conf -Dactivemq.data=/opt/apache-activemq/data -Djolokia.conf=file:/opt/apache-activemq/conf/jolokia-access.xml
Extensions classpath:
[/opt/apache-activemq/lib,/opt/apache-activemq/lib/camel,/opt/apache-activemq/lib/optional,/opt/apache-activemq/lib/web,/opt/apache-activemq/lib/extra]
ACTIVEMQ_HOME: /opt/apache-activemq
ACTIVEMQ_BASE: /opt/apache-activemq
ACTIVEMQ_CONF: /opt/apache-activemq/conf
ACTIVEMQ_DATA: /opt/apache-activemq/data
INFO | Connecting to URL: failover://tcp://localhost:61616 as user: null
INFO | Producing messages to queue://orders-cli
INFO | Using persistent messages
INFO | Sleeping between sends 0 ms
INFO | Running 1 parallel threads
INFO | Successfully connected to tcp://localhost:61616
INFO | producer-1 Started to calculate elapsed time ...
INFO | producer-1 Produced: 1 messages
INFO | producer-1 Elapsed time in second : 0 s
INFO | producer-1 Elapsed time in milli second : 10 milli seconds
INFO: Loading '/opt/apache-activemq/bin/setenv'
INFO: Using java '/opt/java/openjdk/bin/java'
Java Runtime: Eclipse Adoptium 17.0.17 /opt/java/openjdk
Heap sizes: current=67584k free=65684k max=1048576k
JVM args: -Xms64M -Xmx1G -Djava.util.logging.config.file=logging.properties -Djava.security.auth.login.config=/opt/apache-activemq/conf/login.config -Djetty.host=0.0.0.0 --add-reads=java.xml=java.logging --add-opens=java.base/java.security=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.naming/javax.naming.spi=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.base/sun.nio.ch=ALL-UNNAMED --add-exports=java.base/sun.net.www.protocol.http=ALL-UNNAMED --add-exports=java.base/sun.net.www.protocol.https=ALL-UNNAMED --add-exports=java.base/sun.net.www.protocol.jar=ALL-UNNAMED --add-exports=jdk.xml.dom/org.w3c.dom.html=ALL-UNNAMED --add-exports=jdk.naming.rmi/com.sun.jndi.url.rmi=ALL-UNNAMED -Dactivemq.classpath=/opt/apache-activemq/conf: -Dactivemq.home=/opt/apache-activemq -Dactivemq.base=/opt/apache-activemq -Dactivemq.conf=/opt/apache-activemq/conf -Dactivemq.data=/opt/apache-activemq/data -Djolokia.conf=file:/opt/apache-activemq/conf/jolokia-access.xml
Extensions classpath:
[/opt/apache-activemq/lib,/opt/apache-activemq/lib/camel,/opt/apache-activemq/lib/optional,/opt/apache-activemq/lib/web,/opt/apache-activemq/lib/extra]
ACTIVEMQ_HOME: /opt/apache-activemq
ACTIVEMQ_BASE: /opt/apache-activemq
ACTIVEMQ_CONF: /opt/apache-activemq/conf
ACTIVEMQ_DATA: /opt/apache-activemq/data
INFO | Connecting to URL: failover://tcp://localhost:61616 as user: null
INFO | Producing messages to queue://orders-cli
INFO | Using persistent messages
INFO | Sleeping between sends 0 ms
INFO | Running 1 parallel threads
INFO | Successfully connected to tcp://localhost:61616
INFO | producer-1 Started to calculate elapsed time ...
INFO | producer-1 Produced: 1 messages
INFO | producer-1 Elapsed time in second : 0 s
INFO | producer-1 Elapsed time in milli second : 5 milli seconds
session.out.txt
---
status: verified
capturedAt: "2026-08-23T15:19:49.324Z"
dockerImage: "apache/activemq-classic:6.2.0@sha256:992bc29a8459f6772ff14d168a8b011c9cde7a769ec01d72788c9cc4e9229564"
exitCode: 0
---
## status
[cli-tools] $ /opt/apache-activemq/bin/activemq status
INFO: Loading '/opt/apache-activemq/bin/setenv'
INFO: Using java '/opt/java/openjdk/bin/java'
ActiveMQ is running (pid '1')
## create
[cli-tools] $ /opt/apache-activemq/bin/activemq producer --destination queue://orders-cli --messageCount 1 --message order-cli-1
INFO: Loading '/opt/apache-activemq/bin/setenv'
INFO: Using java '/opt/java/openjdk/bin/java'
Java Runtime: Eclipse Adoptium 17.0.17 /opt/java/openjdk
Heap sizes: current=67584k free=65684k max=1048576k
JVM args: -Xms64M -Xmx1G -Djava.util.logging.config.file=logging.properties -Djava.security.auth.login.config=/opt/apache-activemq/conf/login.config -Djetty.host=0.0.0.0 --add-reads=java.xml=java.logging --add-opens=java.base/java.security=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.naming/javax.naming.spi=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.base/sun.nio.ch=ALL-UNNAMED --add-exports=java.base/sun.net.www.protocol.http=ALL-UNNAMED --add-exports=java.base/sun.net.www.protocol.https=ALL-UNNAMED --add-exports=java.base/sun.net.www.protocol.jar=ALL-UNNAMED --add-exports=jdk.xml.dom/org.w3c.dom.html=ALL-UNNAMED --add-exports=jdk.naming.rmi/com.sun.jndi.url.rmi=ALL-UNNAMED -Dactivemq.classpath=/opt/apache-activemq/conf: -Dactivemq.home=/opt/apache-activemq -Dactivemq.base=/opt/apache-activemq -Dactivemq.conf=/opt/apache-activemq/conf -Dactivemq.data=/opt/apache-activemq/data -Djolokia.conf=file:/opt/apache-activemq/conf/jolokia-access.xml
Extensions classpath:
[/opt/apache-activemq/lib,/opt/apache-activemq/lib/camel,/opt/apache-activemq/lib/optional,/opt/apache-activemq/lib/web,/opt/apache-activemq/lib/extra]
ACTIVEMQ_HOME: /opt/apache-activemq
ACTIVEMQ_BASE: /opt/apache-activemq
ACTIVEMQ_CONF: /opt/apache-activemq/conf
ACTIVEMQ_DATA: /opt/apache-activemq/data
INFO | Connecting to URL: failover://tcp://localhost:61616 as user: null
INFO | Producing messages to queue://orders-cli
INFO | Using persistent messages
INFO | Sleeping between sends 0 ms
INFO | Running 1 parallel threads
INFO | Successfully connected to tcp://localhost:61616
INFO | producer-1 Started to calculate elapsed time ...
INFO | producer-1 Produced: 1 messages
INFO | producer-1 Elapsed time in second : 0 s
INFO | producer-1 Elapsed time in milli second : 18 milli seconds
## produce
[cli-tools] $ for i in 2 3: /opt/apache-activemq/bin/activemq producer --destination queue://orders-cli --messageCount 1 --message order-cli-$i ...
INFO: Loading '/opt/apache-activemq/bin/setenv'
INFO: Using java '/opt/java/openjdk/bin/java'
Java Runtime: Eclipse Adoptium 17.0.17 /opt/java/openjdk
Heap sizes: current=67584k free=65909k max=1048576k
JVM args: -Xms64M -Xmx1G -Djava.util.logging.config.file=logging.properties -Djava.security.auth.login.config=/opt/apache-activemq/conf/login.config -Djetty.host=0.0.0.0 --add-reads=java.xml=java.logging --add-opens=java.base/java.security=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.naming/javax.naming.spi=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.base/sun.nio.ch=ALL-UNNAMED --add-exports=java.base/sun.net.www.protocol.http=ALL-UNNAMED --add-exports=java.base/sun.net.www.protocol.https=ALL-UNNAMED --add-exports=java.base/sun.net.www.protocol.jar=ALL-UNNAMED --add-exports=jdk.xml.dom/org.w3c.dom.html=ALL-UNNAMED --add-exports=jdk.naming.rmi/com.sun.jndi.url.rmi=ALL-UNNAMED -Dactivemq.classpath=/opt/apache-activemq/conf: -Dactivemq.home=/opt/apache-activemq -Dactivemq.base=/opt/apache-activemq -Dactivemq.conf=/opt/apache-activemq/conf -Dactivemq.data=/opt/apache-activemq/data -Djolokia.conf=file:/opt/apache-activemq/conf/jolokia-access.xml
Extensions classpath:
[/opt/apache-activemq/lib,/opt/apache-activemq/lib/camel,/opt/apache-activemq/lib/optional,/opt/apache-activemq/lib/web,/opt/apache-activemq/lib/extra]
ACTIVEMQ_HOME: /opt/apache-activemq
ACTIVEMQ_BASE: /opt/apache-activemq
ACTIVEMQ_CONF: /opt/apache-activemq/conf
ACTIVEMQ_DATA: /opt/apache-activemq/data
INFO | Connecting to URL: failover://tcp://localhost:61616 as user: null
INFO | Producing messages to queue://orders-cli
INFO | Using persistent messages
INFO | Sleeping between sends 0 ms
INFO | Running 1 parallel threads
INFO | Successfully connected to tcp://localhost:61616
INFO | producer-1 Started to calculate elapsed time ...
INFO | producer-1 Produced: 1 messages
INFO | producer-1 Elapsed time in second : 0 s
INFO | producer-1 Elapsed time in milli second : 10 milli seconds
INFO: Loading '/opt/apache-activemq/bin/setenv'
INFO: Using java '/opt/java/openjdk/bin/java'
Java Runtime: Eclipse Adoptium 17.0.17 /opt/java/openjdk
Heap sizes: current=67584k free=65684k max=1048576k
JVM args: -Xms64M -Xmx1G -Djava.util.logging.config.file=logging.properties -Djava.security.auth.login.config=/opt/apache-activemq/conf/login.config -Djetty.host=0.0.0.0 --add-reads=java.xml=java.logging --add-opens=java.base/java.security=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.naming/javax.naming.spi=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.base/sun.nio.ch=ALL-UNNAMED --add-exports=java.base/sun.net.www.protocol.http=ALL-UNNAMED --add-exports=java.base/sun.net.www.protocol.https=ALL-UNNAMED --add-exports=java.base/sun.net.www.protocol.jar=ALL-UNNAMED --add-exports=jdk.xml.dom/org.w3c.dom.html=ALL-UNNAMED --add-exports=jdk.naming.rmi/com.sun.jndi.url.rmi=ALL-UNNAMED -Dactivemq.classpath=/opt/apache-activemq/conf: -Dactivemq.home=/opt/apache-activemq -Dactivemq.base=/opt/apache-activemq -Dactivemq.conf=/opt/apache-activemq/conf -Dactivemq.data=/opt/apache-activemq/data -Djolokia.conf=file:/opt/apache-activemq/conf/jolokia-access.xml
Extensions classpath:
[/opt/apache-activemq/lib,/opt/apache-activemq/lib/camel,/opt/apache-activemq/lib/optional,/opt/apache-activemq/lib/web,/opt/apache-activemq/lib/extra]
ACTIVEMQ_HOME: /opt/apache-activemq
ACTIVEMQ_BASE: /opt/apache-activemq
ACTIVEMQ_CONF: /opt/apache-activemq/conf
ACTIVEMQ_DATA: /opt/apache-activemq/data
INFO | Connecting to URL: failover://tcp://localhost:61616 as user: null
INFO | Producing messages to queue://orders-cli
INFO | Using persistent messages
INFO | Sleeping between sends 0 ms
INFO | Running 1 parallel threads
INFO | Successfully connected to tcp://localhost:61616
INFO | producer-1 Started to calculate elapsed time ...
INFO | producer-1 Produced: 1 messages
INFO | producer-1 Elapsed time in second : 0 s
INFO | producer-1 Elapsed time in milli second : 5 milli seconds
## consume
[cli-tools] $ /opt/apache-activemq/bin/activemq consumer --destination queue://orders-cli --messageCount 3
INFO: Loading '/opt/apache-activemq/bin/setenv'
INFO: Using java '/opt/java/openjdk/bin/java'
Java Runtime: Eclipse Adoptium 17.0.17 /opt/java/openjdk
Heap sizes: current=67584k free=65684k max=1048576k
JVM args: -Xms64M -Xmx1G -Djava.util.logging.config.file=logging.properties -Djava.security.auth.login.config=/opt/apache-activemq/conf/login.config -Djetty.host=0.0.0.0 --add-reads=java.xml=java.logging --add-opens=java.base/java.security=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.naming/javax.naming.spi=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.base/sun.nio.ch=ALL-UNNAMED --add-exports=java.base/sun.net.www.protocol.http=ALL-UNNAMED --add-exports=java.base/sun.net.www.protocol.https=ALL-UNNAMED --add-exports=java.base/sun.net.www.protocol.jar=ALL-UNNAMED --add-exports=jdk.xml.dom/org.w3c.dom.html=ALL-UNNAMED --add-exports=jdk.naming.rmi/com.sun.jndi.url.rmi=ALL-UNNAMED -Dactivemq.classpath=/opt/apache-activemq/conf: -Dactivemq.home=/opt/apache-activemq -Dactivemq.base=/opt/apache-activemq -Dactivemq.conf=/opt/apache-activemq/conf -Dactivemq.data=/opt/apache-activemq/data -Djolokia.conf=file:/opt/apache-activemq/conf/jolokia-access.xml
Extensions classpath:
[/opt/apache-activemq/lib,/opt/apache-activemq/lib/camel,/opt/apache-activemq/lib/optional,/opt/apache-activemq/lib/web,/opt/apache-activemq/lib/extra]
ACTIVEMQ_HOME: /opt/apache-activemq
ACTIVEMQ_BASE: /opt/apache-activemq
ACTIVEMQ_CONF: /opt/apache-activemq/conf
ACTIVEMQ_DATA: /opt/apache-activemq/data
INFO | Connecting to URL: failover://tcp://localhost:61616 as user: null
INFO | Consuming queue://orders-cli
INFO | Sleeping between receives 0 ms
INFO | Running 1 parallel threads
INFO | Successfully connected to tcp://localhost:61616
INFO | consumer-1 wait until 3 messages are consumed
INFO | consumer-1 Received order-cli-1
INFO | consumer-1 Received order-cli-2
INFO | consumer-1 Received order-cli-3
INFO | consumer-1 Consumed: 3 messages
INFO | consumer-1 Consumer thread finished
## verify
[cli-tools] $ timeout 15 /opt/apache-activemq/bin/activemq consumer --destination queue://orders-cli --messageCount 1(空队列将阻塞至被 timeout 杀掉,预期 exit 124)
INFO: Loading '/opt/apache-activemq/bin/setenv'
INFO: Using java '/opt/java/openjdk/bin/java'
Java Runtime: Eclipse Adoptium 17.0.17 /opt/java/openjdk
Heap sizes: current=67584k free=65684k max=1048576k
JVM args: -Xms64M -Xmx1G -Djava.util.logging.config.file=logging.properties -Djava.security.auth.login.config=/opt/apache-activemq/conf/login.config -Djetty.host=0.0.0.0 --add-reads=java.xml=java.logging --add-opens=java.base/java.security=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.naming/javax.naming.spi=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.base/sun.nio.ch=ALL-UNNAMED --add-exports=java.base/sun.net.www.protocol.http=ALL-UNNAMED --add-exports=java.base/sun.net.www.protocol.https=ALL-UNNAMED --add-exports=java.base/sun.net.www.protocol.jar=ALL-UNNAMED --add-exports=jdk.xml.dom/org.w3c.dom.html=ALL-UNNAMED --add-exports=jdk.naming.rmi/com.sun.jndi.url.rmi=ALL-UNNAMED -Dactivemq.classpath=/opt/apache-activemq/conf: -Dactivemq.home=/opt/apache-activemq -Dactivemq.base=/opt/apache-activemq -Dactivemq.conf=/opt/apache-activemq/conf -Dactivemq.data=/opt/apache-activemq/data -Djolokia.conf=file:/opt/apache-activemq/conf/jolokia-access.xml
Extensions classpath:
[/opt/apache-activemq/lib,/opt/apache-activemq/lib/camel,/opt/apache-activemq/lib/optional,/opt/apache-activemq/lib/web,/opt/apache-activemq/lib/extra]
ACTIVEMQ_HOME: /opt/apache-activemq
ACTIVEMQ_BASE: /opt/apache-activemq
ACTIVEMQ_CONF: /opt/apache-activemq/conf
ACTIVEMQ_DATA: /opt/apache-activemq/data
INFO | Connecting to URL: failover://tcp://localhost:61616 as user: null
INFO | Consuming queue://orders-cli
INFO | Sleeping between receives 0 ms
INFO | Running 1 parallel threads
INFO | Successfully connected to tcp://localhost:61616
INFO | consumer-1 wait until 1 messages are consumed
[cli-tools] verify exitCode=124(124=被 timeout 杀掉,说明队列已空)
status.out.txt
[cli-tools] $ /opt/apache-activemq/bin/activemq status INFO: Loading '/opt/apache-activemq/bin/setenv' INFO: Using java '/opt/java/openjdk/bin/java' ActiveMQ is running (pid '1')
verify.out.txt
[cli-tools] $ timeout 15 /opt/apache-activemq/bin/activemq consumer --destination queue://orders-cli --messageCount 1(空队列将阻塞至被 timeout 杀掉,预期 exit 124)
INFO: Loading '/opt/apache-activemq/bin/setenv'
INFO: Using java '/opt/java/openjdk/bin/java'
Java Runtime: Eclipse Adoptium 17.0.17 /opt/java/openjdk
Heap sizes: current=67584k free=65684k max=1048576k
JVM args: -Xms64M -Xmx1G -Djava.util.logging.config.file=logging.properties -Djava.security.auth.login.config=/opt/apache-activemq/conf/login.config -Djetty.host=0.0.0.0 --add-reads=java.xml=java.logging --add-opens=java.base/java.security=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.naming/javax.naming.spi=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.base/sun.nio.ch=ALL-UNNAMED --add-exports=java.base/sun.net.www.protocol.http=ALL-UNNAMED --add-exports=java.base/sun.net.www.protocol.https=ALL-UNNAMED --add-exports=java.base/sun.net.www.protocol.jar=ALL-UNNAMED --add-exports=jdk.xml.dom/org.w3c.dom.html=ALL-UNNAMED --add-exports=jdk.naming.rmi/com.sun.jndi.url.rmi=ALL-UNNAMED -Dactivemq.classpath=/opt/apache-activemq/conf: -Dactivemq.home=/opt/apache-activemq -Dactivemq.base=/opt/apache-activemq -Dactivemq.conf=/opt/apache-activemq/conf -Dactivemq.data=/opt/apache-activemq/data -Djolokia.conf=file:/opt/apache-activemq/conf/jolokia-access.xml
Extensions classpath:
[/opt/apache-activemq/lib,/opt/apache-activemq/lib/camel,/opt/apache-activemq/lib/optional,/opt/apache-activemq/lib/web,/opt/apache-activemq/lib/extra]
ACTIVEMQ_HOME: /opt/apache-activemq
ACTIVEMQ_BASE: /opt/apache-activemq
ACTIVEMQ_CONF: /opt/apache-activemq/conf
ACTIVEMQ_DATA: /opt/apache-activemq/data
INFO | Connecting to URL: failover://tcp://localhost:61616 as user: null
INFO | Consuming queue://orders-cli
INFO | Sleeping between receives 0 ms
INFO | Running 1 parallel threads
INFO | Successfully connected to tcp://localhost:61616
INFO | consumer-1 wait until 1 messages are consumed
[cli-tools] verify exitCode=124(124=被 timeout 杀掉,说明队列已空)