Class: HomeQ::SOBS::Client
- Inherits:
-
Connection
- Object
- EventMachine::Connection
- Connection
- HomeQ::SOBS::Client
- Defined in:
- lib/homeq/sobs/client.rb
Constant Summary
Constants inherited from Connection
HomeQ::SOBS::Connection::ALL_MESSAGES, HomeQ::SOBS::Connection::ARGS_AND_BODY_MESSAGES, HomeQ::SOBS::Connection::ARG_AND_BODY_MESSAGES, HomeQ::SOBS::Connection::ARG_MESSAGES, HomeQ::SOBS::Connection::BODY_MESSAGES, HomeQ::SOBS::Connection::HEADER_REGEX, HomeQ::SOBS::Connection::HELLO_TIMER_LENGTH, HomeQ::SOBS::Connection::MAX_INPUT_MSGS_PER_READ_CYCLE, HomeQ::SOBS::Connection::NO_ARG_MESSAGES, HomeQ::SOBS::Connection::OUTBOUND_MAX, HomeQ::SOBS::Connection::PUSH_TIMER_LENGTH, HomeQ::SOBS::Connection::REFUSE_SEND_THRESHOLD
Constants included from HomeQ
Instance Attribute Summary collapse
-
#host ⇒ Object
Returns the value of attribute host.
-
#port ⇒ Object
Returns the value of attribute port.
-
#queue ⇒ Object
the queue that owns this connection.
-
#retry ⇒ Object
Returns the value of attribute retry.
Attributes inherited from Connection
#outbound_max, #peer, #refuse_send_threshold, #server, #state
Class Method Summary collapse
Instance Method Summary collapse
- #closed ⇒ Object
-
#initialize ⇒ Client
constructor
A new instance of Client.
-
#opened ⇒ Object
SOBS::Connection entry points.
-
#readable? ⇒ Boolean
Other.
- #receive_deleted(message) ⇒ Object
- #receive_inserted(message) ⇒ Object
-
#receive_reserved(message) ⇒ Object
High level message interface - receiving.
- #writeable? ⇒ Boolean
Methods inherited from Connection
#cancel_hello_timer, #close, #closing, #connection_completed, #enter_congestion, #exit_congestion, #ok_to_receive?, #parse_header, #parse_incoming_data, #post_init, #process_data, #protocol_version_ok?, #receive_data, #receive_hello, #receive_message, #remote_endpoint, #send_to_peer, #setup_peer, #should_refuse_send?, #start_closing, #to_s, #unbind, #unknown_message, #wait_for_hello
Methods included from HomeQ
calculated_homeq_env, calculated_homeq_topology, included, queue_list_for_host_from_topology
Methods included from Sender
#book_it, #buried, #bury, #deadline_soon, #delete, #deleted, #hello, #inserted, #kick, #kicked, #not_found, #put, #release, #released, #reserve, #reserved, #stats, #stats_job, #subscribe, #unsubscribe
Methods included from Base::Logging
Constructor Details
#initialize ⇒ Client
Returns a new instance of Client.
50 51 52 53 |
# File 'lib/homeq/sobs/client.rb', line 50 def initialize super @host = @port = @retry = nil end |
Instance Attribute Details
#host ⇒ Object
Returns the value of attribute host.
34 35 36 |
# File 'lib/homeq/sobs/client.rb', line 34 def host @host end |
#port ⇒ Object
Returns the value of attribute port.
35 36 37 |
# File 'lib/homeq/sobs/client.rb', line 35 def port @port end |
#queue ⇒ Object
the queue that owns this connection
33 34 35 |
# File 'lib/homeq/sobs/client.rb', line 33 def queue @queue end |
#retry ⇒ Object
Returns the value of attribute retry.
36 37 38 |
# File 'lib/homeq/sobs/client.rb', line 36 def retry @retry end |
Class Method Details
.connect(host, port, interval, server, queue) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/homeq/sobs/client.rb', line 38 def self.connect(host, port, interval, server, queue) EventMachine::connect(host, port, self) { |conn| conn.host = host conn.port = port conn.retry = interval conn.server = server conn.queue = queue } end |
Instance Method Details
#closed ⇒ Object
65 66 67 68 |
# File 'lib/homeq/sobs/client.rb', line 65 def closed @queue.closed if @queue retry_connection_after_interval(@retry) end |
#opened ⇒ Object
SOBS::Connection entry points
60 61 62 63 |
# File 'lib/homeq/sobs/client.rb', line 60 def opened @queue.opened(self) if @queue subscribe if readable? end |
#readable? ⇒ Boolean
Other
92 93 94 |
# File 'lib/homeq/sobs/client.rb', line 92 def readable? @queue.readable? end |
#receive_deleted(message) ⇒ Object
83 84 85 |
# File 'lib/homeq/sobs/client.rb', line 83 def receive_deleted() @queue.deleted() end |
#receive_inserted(message) ⇒ Object
79 80 81 |
# File 'lib/homeq/sobs/client.rb', line 79 def receive_inserted() @queue.ack() end |
#receive_reserved(message) ⇒ Object
High level message interface - receiving
75 76 77 |
# File 'lib/homeq/sobs/client.rb', line 75 def receive_reserved() @queue.create_job() end |
#writeable? ⇒ Boolean
96 97 98 |
# File 'lib/homeq/sobs/client.rb', line 96 def writeable? @queue.writeable? end |