From d66d576676f8fcc0ee3fc11fb34322f499c43ca8 Mon Sep 17 00:00:00 2001 From: Ted Ross Date: Fri, 27 Mar 2009 20:46:24 +0000 Subject: QPID-1702 QPID-1706 Updated qmf console in Python and Ruby - Added support for asynchronous method invocation - Added option to override timeout for method request and get request - Added exception handler in delegates.rb to catch Sasl errors - Added tests for the async method features git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@759341 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/ruby/lib/qpid/delegates.rb | 14 +++++-- qpid/ruby/lib/qpid/qmf.rb | 61 ++++++++++++++++++++++------- qpid/ruby/tests/qmf.rb | 86 ++++++++++++++++++++++++++++++++++------- 3 files changed, 130 insertions(+), 31 deletions(-) (limited to 'qpid/ruby') diff --git a/qpid/ruby/lib/qpid/delegates.rb b/qpid/ruby/lib/qpid/delegates.rb index 171f310e48..8d866e895f 100644 --- a/qpid/ruby/lib/qpid/delegates.rb +++ b/qpid/ruby/lib/qpid/delegates.rb @@ -200,10 +200,16 @@ module Qpid start.mechanisms.each do |m| mech_list += m + " " end - resp = Sasl.client_start(@saslConn, mech_list) - ch.connection_start_ok(:client_properties => PROPERTIES, - :mechanism => resp[2], - :response => resp[1]) + begin + resp = Sasl.client_start(@saslConn, mech_list) + ch.connection_start_ok(:client_properties => PROPERTIES, + :mechanism => resp[2], + :response => resp[1]) + rescue exception + ch.connection_close(:message => $!.message) + @connection.failed = true + @connection.signal + end end def connection_secure(ch, secure) diff --git a/qpid/ruby/lib/qpid/qmf.rb b/qpid/ruby/lib/qpid/qmf.rb index ee165305c3..ebca7ee5ab 100644 --- a/qpid/ruby/lib/qpid/qmf.rb +++ b/qpid/ruby/lib/qpid/qmf.rb @@ -58,9 +58,14 @@ module Qpid::Qmf # Invoked when an event is raised def event(broker, event); end + # Invoked when an agent heartbeat is received. def heartbeat(agent, timestamp); end + # Invoked when the connection sequence reaches the point where broker information is available. def broker_info(broker); end + + # Invoked when a method response from an asynchronous method call is received. + def method_response(broker, seq, response); end end class BrokerURL @@ -105,7 +110,7 @@ module Qpid::Qmf CONTEXT_STARTUP = 2 CONTEXT_MULTIGET = 3 - GET_WAIT_TIME = 60 + DEFAULT_GET_WAIT_TIME = 60 include MonitorMixin @@ -305,11 +310,17 @@ module Qpid::Qmf # Otherwise, the query will go to all agents. # # :agent = - supply an agent from the list returned by getAgents. + # # If the get query is to be restricted to one broker (as opposed to # all connected brokers), add the following argument: # # :broker = - supply a broker as returned by addBroker. # + # The default timeout for this synchronous operation is 60 seconds. To change the timeout, + # use the following argument: + # + # :_timeout =