Class: RosettaQueue::Gateway::NullAdapter
- Inherits:
-
Object
- Object
- RosettaQueue::Gateway::NullAdapter
- Defined in:
- lib/rosetta_queue/adapters/null.rb
Overview
The null adapter lets all send messages enter into the ether and so is ideal for modes when you do not want to incur the overhead of a real adapter. You can not consume with this adapter however.
In your RosettaQueue definition block, and your using rails, you could base your adapter type on Rails.env:
RosettaQueue::Adapter.define do |a|
if Rails.env == 'production' || ENV["RUNNING_STORIES"] == "true"
a.user = ""
a.password = ""
a.host = "localhost"
a.port = 61613
a.type = "stomp"
else
a.type = "null"
end
end
(if you follow this example and are using stories be sure to set ENV = “true” in your helper.rb or env.rb file)
Instance Method Summary collapse
- #disconnect ⇒ Object
-
#initialize(adapter_settings) ⇒ NullAdapter
constructor
A new instance of NullAdapter.
- #receive ⇒ Object
- #receive_with(message_handler) ⇒ Object
- #send_message(queue, message, options) ⇒ Object
- #subscribe(queue, options) ⇒ Object
- #unsubscribe(queue) ⇒ Object
Constructor Details
#initialize(adapter_settings) ⇒ NullAdapter
Returns a new instance of NullAdapter.
26 27 28 |
# File 'lib/rosetta_queue/adapters/null.rb', line 26 def initialize(adapter_settings) # no-op end |
Instance Method Details
#disconnect ⇒ Object
30 31 32 |
# File 'lib/rosetta_queue/adapters/null.rb', line 30 def disconnect # no-op end |
#receive ⇒ Object
34 35 36 |
# File 'lib/rosetta_queue/adapters/null.rb', line 34 def receive raise "Null Adapter is in use, you can not consume messages!" end |
#receive_with(message_handler) ⇒ Object
38 39 40 |
# File 'lib/rosetta_queue/adapters/null.rb', line 38 def receive_with() raise "Null Adapter is in use, you can not consume messages!" end |
#send_message(queue, message, options) ⇒ Object
42 43 44 |
# File 'lib/rosetta_queue/adapters/null.rb', line 42 def (queue, , ) # no-op end |
#subscribe(queue, options) ⇒ Object
46 47 48 |
# File 'lib/rosetta_queue/adapters/null.rb', line 46 def subscribe(queue, ) # no-op end |
#unsubscribe(queue) ⇒ Object
50 51 52 |
# File 'lib/rosetta_queue/adapters/null.rb', line 50 def unsubscribe(queue) # no-op end |