Created
July 9, 2013 20:31
-
-
Save bbrowning/5961008 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MessagingStatsService | |
def start | |
Thread.new do | |
until @done | |
queues.each do |queue| | |
counter = org.hornetq.api.core.management.MessageCounterInfo.from_json(queue.list_message_counter) | |
puts "Queue #{queue.name} count: #{counter.count} countDelta: #{counter.count_delta} depth: #{counter.depth} depth_delta: #{counter.depth_delta}" | |
end | |
end | |
end | |
end | |
def stop | |
@done = true | |
end | |
def queues | |
management_service.getResources(org.hornetq.jms.management.impl.JMSQueueControlImpl.java_class) | |
end | |
def management_service | |
hornetq_server.management_service | |
end | |
def hornetq_server | |
@hornetq_server ||= TorqueBox.fetch('jboss.messaging.default') | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment