在ActiveMQ中,我是否可以检测邮件从发布者传递给订阅者的时间? 或者,我可以看到消息从发布者到主题(JMS服务)以及从(JMS服务)主题到Subsriber的单独时间吗?
答案 0 :(得分:2)
当JMS消息到达使用者时,您可以查看JMSTimestamp
标头属性。根据Javadoc:
JMSTimestamp标头字段包含邮件传递的时间 发送。
然后,您可以简单地从当前系统时间中减去JMSTimestamp,并通过该JMS消息计算飞行中的time taken
。
答案 1 :(得分:0)
有一个Maven plugin for AMQ performance testing,它可能就是您要搜索的内容。
否则,您可以使用某些负载测试工具(例如Apache jMeter)进行一些测量,然后查看您可以读/写的消息数/秒。
请注意,如果你坚持不懈和/或不做事,你会有很大的差异。
更新
您可以通过配置conf / log4j.properties并设置:
来对日志执行某些操作log4j.rootLogger=TRACE, logfile, console
然后在data / activemq.log中,您可以获得put消息的一些信息。数字代表什么并不是很明显,所以你应该确保定义一个测试场景。以下时间戳是由HermesJMS向ActiveMQ发送到队列(myqueue)的消息:
2012-06-06 16:31:19,979 | DEBUG | localhost adding consumer: ID:GOTL19946-53234-
1338993070006-0:2:3:1 for destination: queue://myqueue |org.apache.activemq.broker.region.AbstractRegion | ActiveMQ Transport: tcp:///127.0.0.1:53236
2012-06-06 16:31:19,989 | DEBUG | queue://myqueue add sub: QueueBrowserSubscription: consumer=ID:GOTL19946-53234-1338993070006-0:2:3:1, destinations=0, dispatched=0, delivered=0, pending=0, dequeues: 0, dispatched: 0, inflight: 0 | org.apache.activemq.broker.region.Queue | ActiveMQ Transport: tcp:///127.0.0.1:53236
2012-06-06 16:31:19,989 | DEBUG | myqueue toPageIn: 1, Inflight: 0, pagedInMessages.size 0, enqueueCount: 1, dequeueCount: 0 | org.apache.activemq.broker.region.Queue | Queue:myqueue
2012-06-06 16:31:19,989 | TRACE | QueueStorePrefetch513024249 - fillBatch | org.apache.activemq.broker.region.cursors.AbstractStoreCursor | Queue:myqueue
2012-06-06 16:31:19,989 | DEBUG | dispatch to browser: QueueBrowserSubscription: consumer=ID:GOTL19946-53234-1338993070006-0:2:3:1, destinations=1, dispatched=0, delivered=0, pending=0, already dispatched/paged count: 1 | org.apache.activemq.broker.region.Queue | Queue:myqueue
2012-06-06 16:31:19,999 | TRACE | ID:GOTL19946-53234-1338993070006-0:2:3:1 dispatched: ID:GOTL19946-53234-1338993070006-0:2:2:1:1 - queue://myqueue, dispatched: 1, inflight: 1 | org.apache.activemq.broker.region.PrefetchSubscription | ActiveMQ Connection Dispatcher: /127.0.0.1:53236
2012-06-06 16:31:19,999 | TRACE | ack:MessageAck {commandId = 13, responseRequired = false, ackType = 2, consumerId = ID:GOTL19946-53234-1338993070006-0:2:3:1, firstMessageId = ID:GOTL19946-53234-1338993070006-0:2:2:1:1, lastMessageId = ID:GOTL19946-53234- 1338993070006-0:2:2:1:1, destination = queue://myqueue, transactionId = TX:ID:GOTL19946- 53234-1338993070006-0:2:2, messageCount = 1, poisonCause = null} | org.apache.activemq.broker.region.PrefetchSubscription | ActiveMQ Transport: tcp:///127.0.0.1:53236
2012-06-06 16:31:19,999 | DEBUG | commit: TX:ID:GOTL19946-53234-1338993070006-0:2:2 syncCount: 1 | org.apache.activemq.transaction.LocalTransaction | ActiveMQ Transport: tcp:///127.0.0.1:53236
2012-06-06 16:31:19,999 | DEBUG | myqueue toPageIn: 0, Inflight: 1, pagedInMessages.size 1, enqueueCount: 1, dequeueCount: 0 | org.apache.activemq.broker.region.Queue | Queue:myqueue
2012-06-06 16:31:20,049 | DEBUG | localhost removing consumer: ID:GOTL19946-53234-1338993070006-0:2:3:1 for destination: queue://myqueue | org.apache.activemq.broker.region.AbstractRegion | ActiveMQ Transport: tcp:///127.0.0.1:53236
2012-06-06 16:31:20,049 | DEBUG | queue://myqueue remove sub: QueueBrowserSubscription: consumer=ID:GOTL19946-53234-1338993070006-0:2:3:1, destinations=1, dispatched=0, delivered=1, pending=0, lastDeliveredSeqId: 67, dequeues: 0, dispatched: 1, inflight: 0 | org.apache.activemq.broker.region.Queue | ActiveMQ Transport: tcp:///127.0.0.1:53236
2012-06-06 16:31:20,049 | DEBUG | myqueue toPageIn: 0, Inflight: 0, pagedInMessages.size 1, enqueueCount: 1, dequeueCount: 0 | org.apache.activemq.broker.region.Queue | Queue:myqueue