lib/onstomp/client.rb in onstomp-1.0.3 vs lib/onstomp/client.rb in onstomp-1.0.4
- old
+ new
@@ -45,10 +45,21 @@
# The class to use when instantiating a new IO processor for the connection.
# Defaults to {OnStomp::Components::ThreadedProcessor}
# @return [Class]
attr_configurable_processor :processor
+ # The number of seconds to wait before a write-blocked connection is
+ # considered dead. Defaults to 120 seconds.
+ # @return [Fixnum]
+ attr_configurable_int :write_timeout, :default => 120
+
+ # The number of seconds to wait before a connection that is read-blocked
+ # during the {OnStomp::Connections::Base#connect connect} phase is
+ # considered dead. Defaults to 120 seconds.
+ # @return [Fixnum]
+ attr_configurable_int :read_timeout, :default => 120
+
# @api gem:1 STOMP:1.0,1.1
# Creates a new client for the specified uri and optional hash of options.
# @param [String,URI] uri
# @param [{Symbol => Object}] options
def initialize uri, options={}
@@ -69,10 +80,11 @@
# @return [self]
def connect headers={}
@connection = OnStomp::Connections.connect self, headers,
{ :'accept-version' => @versions.join(','), :host => @host,
:'heart-beat' => @heartbeats.join(','), :login => @login,
- :passcode => @passcode }, pending_connection_events
+ :passcode => @passcode }, pending_connection_events,
+ read_timeout, write_timeout
processor_inst.start
self
end
alias :open :connect