Skip to content

Instantly share code, notes, and snippets.

@bbrowning
Created July 9, 2013 20:31
Show Gist options
  • Save bbrowning/5961008 to your computer and use it in GitHub Desktop.
Save bbrowning/5961008 to your computer and use it in GitHub Desktop.
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