Created
May 31, 2011 22:30
-
-
Save jsvd/1001426 to your computer and use it in GitHub Desktop.
restart subscription connection if dequeue lag behind enqueue
This file contains hidden or 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
| require 'rubygems' | |
| require 'jmx4r' | |
| JMX::MBean.establish_connection :host => "localhost", :port => 9999, :username => "pwd", :password => "pwd" | |
| JMX::MBean.find_all_by_name("org.apache.activemq:BrokerName=inner-broker,Type=Subscription,persistentMode=Non-Durable,destinationType=Topic,destinationName=pulso.>,*").each do |sub| | |
| next unless sub.enqueue_counter - sub.dequeue_counter > 100 | |
| conn = JMX::MBean.find_all_by_name("org.apache.activemq:BrokerName=inner-broker,Type=Connection,ConnectorName=inner-openwire,Connection=ID_#{conn_id.split(":")[1][0...-2]}*").first | |
| conn.stop | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment