我正在使用jmx监控ActiveMQ。我使用以下链接获取ActiveMQ摘要
http://localhost:8161/api/jolokia/read/org.apache.activemq:type=Broker,brokerName=localhost/BrokerId,TotalEnqueueCount,TotalDequeueCount,TotalConsumerCount,TotalMessageCount,TotalConnectionsCount,TotalConsumerCount,TotalProducerCount,MemoryLimit,MemoryPercentUsage,StoreLimit,StorePercentUsage
时间T1
我正在向ActiveMQ发送100条消息,但我没有将任何消息出列。现在总结如下所示
{
"timestamp" : 1437996108,
"status" : 200,
"request" : {
"mbean" : "org.apache.activemq:brokerName=localhost,type=Broker",
"attribute" : ["BrokerId", "TotalEnqueueCount", "TotalDequeueCount", "TotalConsumerCount", "TotalMessageCount", "TotalConnectionsCount", "TotalConsumerCount", "TotalProducerCount", "MemoryLimit", "MemoryPercentUsage", "StoreLimit", "StorePercentUsage"],
"type" : "read"
},
"value" : {
"BrokerId" : "ID:synclap5489-54676-1437995895016-0:1",
"TotalConnectionsCount" : 100,
"TotalDequeueCount" : 0,
"StoreLimit" : 104857600,
"TotalConsumerCount" : 0,
"TotalMessageCount" : 100,
"TotalProducerCount" : 0,
"MemoryPercentUsage" : 0,
"StorePercentUsage" : 9,
"TotalEnqueueCount" : 100,
"MemoryLimit" : 739717939
}
}
并停止ActiveMQ服务器,使100条消息处于Pending状态。
时间T2
再次启动ActiveMQ并发送另外100条消息,但不发送任何消息。现在Json数据如下所示
{
"timestamp" : 1437996721,
"status" : 200,
"request" : {
"mbean" : "org.apache.activemq:brokerName=localhost,type=Broker",
"attribute" : ["BrokerId", "TotalEnqueueCount", "TotalDequeueCount", "TotalConsumerCount", "TotalMessageCount", "TotalConnectionsCount", "TotalConsumerCount", "TotalProducerCount", "MemoryLimit", "MemoryPercentUsage", "StoreLimit", "StorePercentUsage"],
"type" : "read"
},
"value" : {
"BrokerId" : "ID:synclap5489-55183-1437996657303-0:1",
"TotalConnectionsCount" : 100,
"TotalDequeueCount" : 0,
"StoreLimit" : 104857600,
"TotalConsumerCount" : 0,
"TotalMessageCount" : 100,
"TotalProducerCount" : 0,
"MemoryPercentUsage" : 0,
"StorePercentUsage" : 9,
"TotalEnqueueCount" : 100,
"MemoryLimit" : 739717939
}
}
Deque之后
将所有消息出列后,我将获得如下所示的json数据
{
"timestamp" : 1437997015,
"status" : 200,
"request" : {
"mbean" : "org.apache.activemq:brokerName=localhost,type=Broker",
"attribute" : ["BrokerId", "TotalEnqueueCount", "TotalDequeueCount", "TotalConsumerCount", "TotalMessageCount", "TotalConnectionsCount", "TotalConsumerCount", "TotalProducerCount", "MemoryLimit", "MemoryPercentUsage", "StoreLimit", "StorePercentUsage"],
"type" : "read"
},
"value" : {
"BrokerId" : "ID:synclap5489-55183-1437996657303-0:1",
"TotalConnectionsCount" : 101,
"TotalDequeueCount" : 200,
"StoreLimit" : 104857600,
"TotalConsumerCount" : 1,
"TotalMessageCount" : -100,
"TotalProducerCount" : 0,
"MemoryPercentUsage" : 0,
"StorePercentUsage" : 9,
"TotalEnqueueCount" : 100,
"MemoryLimit" : 739717939
}
}
TotalDequeueCount更改为200 TotalEnqueueCount保持100 TotalMessageCount更改-100。
我的问题:
为什么我在TotalMessageCount中获得负值?
为什么只有在使用待处理消息重新启动代理时才会发生这种情况?
如何解决这个问题?