Class: RabbitRPC::Connection
- Inherits:
-
Object
- Object
- RabbitRPC::Connection
- Includes:
- Logging
- Defined in:
- lib/rabbit_rpc/connection.rb
Constant Summary collapse
- PREFETCH_DEFAULT =
5
Instance Attribute Summary collapse
-
#opts ⇒ Object
readonly
Returns the value of attribute opts.
-
#prefetch ⇒ Object
readonly
Returns the value of attribute prefetch.
-
#queue_name ⇒ Object
readonly
Returns the value of attribute queue_name.
-
#uri ⇒ Object
readonly
Returns the value of attribute uri.
Instance Method Summary collapse
-
#initialize(queue_name, uri, prefetch, opts = {}) ⇒ Connection
constructor
A new instance of Connection.
- #listen! ⇒ Object
Methods included from Logging
included, log_exception, logger
Constructor Details
#initialize(queue_name, uri, prefetch, opts = {}) ⇒ Connection
Returns a new instance of Connection.
12 13 14 15 16 17 |
# File 'lib/rabbit_rpc/connection.rb', line 12 def initialize(queue_name, uri, prefetch, opts = {}) @queue_name = queue_name @uri = uri @opts = opts @prefetch = prefetch || PREFETCH_DEFAULT end |
Instance Attribute Details
#opts ⇒ Object (readonly)
Returns the value of attribute opts.
10 11 12 |
# File 'lib/rabbit_rpc/connection.rb', line 10 def opts @opts end |
#prefetch ⇒ Object (readonly)
Returns the value of attribute prefetch.
10 11 12 |
# File 'lib/rabbit_rpc/connection.rb', line 10 def prefetch @prefetch end |
#queue_name ⇒ Object (readonly)
Returns the value of attribute queue_name.
10 11 12 |
# File 'lib/rabbit_rpc/connection.rb', line 10 def queue_name @queue_name end |
#uri ⇒ Object (readonly)
Returns the value of attribute uri.
10 11 12 |
# File 'lib/rabbit_rpc/connection.rb', line 10 def uri @uri end |
Instance Method Details
#listen! ⇒ Object
19 20 21 22 23 24 |
# File 'lib/rabbit_rpc/connection.rb', line 19 def listen! EventMachine.run do close_connection_on_interrupt subscribe_to_queue end end |