Class: SMQueue::AmqpAdapter
- Defined in:
- lib/smqueue/adapters/amqp.rb
Defined Under Namespace
Classes: Configuration
Instance Method Summary collapse
- #get(*args, &block) ⇒ Object
-
#initialize(*args) ⇒ AmqpAdapter
constructor
A new instance of AmqpAdapter.
- #put(*args, &block) ⇒ Object
Methods inherited from Adapter
Methods inherited from Doodle
Constructor Details
#initialize(*args) ⇒ AmqpAdapter
Returns a new instance of AmqpAdapter.
11 12 13 14 15 |
# File 'lib/smqueue/adapters/amqp.rb', line 11 def initialize(*args) super = args.first @configuration = [:configuration] end |
Instance Method Details
#get(*args, &block) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/smqueue/adapters/amqp.rb', line 24 def get(*args, &block) if block_given? EM.run { channel.subscribe { |header, body| yield ::SMQueue::Message(:headers => header, :body => body) } } else raise "TODO: Implement me" end end |
#put(*args, &block) ⇒ Object
17 18 19 20 21 22 |
# File 'lib/smqueue/adapters/amqp.rb', line 17 def put(*args, &block) AMQP.start { channel.publish(args[0]) AMQP.stop { EM.stop } } end |