Class: RackRabbit::Adapter
- Inherits:
-
Object
- Object
- RackRabbit::Adapter
show all
- Defined in:
- lib/rack-rabbit/adapter.rb,
lib/rack-rabbit/adapter/amqp.rb,
lib/rack-rabbit/adapter/mock.rb,
lib/rack-rabbit/adapter/bunny.rb
Defined Under Namespace
Classes: AMQP, Bunny, Mock
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(options) ⇒ Adapter
Returns a new instance of Adapter.
32
33
34
35
36
|
# File 'lib/rack-rabbit/adapter.rb', line 32
def initialize(options)
@connection_options = options
@started = nil
@connected = nil
end
|
Instance Attribute Details
#connection_options ⇒ Object
30
31
32
|
# File 'lib/rack-rabbit/adapter.rb', line 30
def connection_options
@connection_options
end
|
Class Method Details
.load(options) ⇒ Object
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/rack-rabbit/adapter.rb', line 8
def self.load(options)
adapter = options.delete(:adapter) || :bunny
if adapter.is_a?(Symbol) || adapter.is_a?(String)
adapter = case adapter.to_s.downcase.to_sym
when :bunny
require 'rack-rabbit/adapter/bunny'
RackRabbit::Adapter::Bunny
when :amqp
require 'rack-rabbit/adapter/amqp'
RackRabbit::Adapter::AMQP
when :mock
require 'rack-rabbit/adapter/mock'
RackRabbit::Adapter::Mock
else
raise ArgumentError, "unknown rabbitMQ adapter #{adapter}"
end
end
adapter.new(options)
end
|
Instance Method Details
#ack(delivery_tag) ⇒ Object
76
77
78
|
# File 'lib/rack-rabbit/adapter.rb', line 76
def ack(delivery_tag)
raise NotImplementedError, "derived classes must implement this"
end
|
#connect ⇒ Object
50
51
52
|
# File 'lib/rack-rabbit/adapter.rb', line 50
def connect
raise NotImplementedError, "derived classes must implement this"
end
|
#connected? ⇒ Boolean
58
59
60
|
# File 'lib/rack-rabbit/adapter.rb', line 58
def connected?
raise NotImplementedError, "derived classes must implement this"
end
|
#disconnect ⇒ Object
54
55
56
|
# File 'lib/rack-rabbit/adapter.rb', line 54
def disconnect
raise NotImplementedError, "derived classes must implement this"
end
|
#publish(payload, properties) ⇒ Object
66
67
68
|
# File 'lib/rack-rabbit/adapter.rb', line 66
def publish(payload, properties)
raise NotImplementedError, "derived classes must implement this"
end
|
#reject(delivery_tag) ⇒ Object
80
81
82
|
# File 'lib/rack-rabbit/adapter.rb', line 80
def reject(delivery_tag)
raise NotImplementedError, "derived classes must implement this"
end
|
#shutdown ⇒ Object
42
43
44
|
# File 'lib/rack-rabbit/adapter.rb', line 42
def shutdown
end
|
#started? ⇒ Boolean
46
47
48
|
# File 'lib/rack-rabbit/adapter.rb', line 46
def started?
true end
|
#startup ⇒ Object
38
39
40
|
# File 'lib/rack-rabbit/adapter.rb', line 38
def startup
end
|
#subscribe(options = {}, &block) ⇒ Object
62
63
64
|
# File 'lib/rack-rabbit/adapter.rb', line 62
def subscribe(options = {}, &block)
raise NotImplementedError, "derived classes must implement this"
end
|
#with_reply_queue(&block) ⇒ Object
70
71
72
|
# File 'lib/rack-rabbit/adapter.rb', line 70
def with_reply_queue(&block)
raise NotImplementedError, "derived classes must implement this"
end
|