Class: NebulousStomp::StompHandlerNull
- Inherits:
-
StompHandler
- Object
- StompHandler
- NebulousStomp::StompHandlerNull
- Defined in:
- lib/nebulous_stomp/stomp_handler_null.rb
Overview
Behaves just like StompHandler, except, does nothing and expects no stomp connection
Instance Attribute Summary collapse
-
#fake_messages ⇒ Object
readonly
Returns the value of attribute fake_messages.
Attributes inherited from StompHandler
Instance Method Summary collapse
- #calc_reply_id ⇒ Object
- #connected? ⇒ Boolean
-
#initialize(hash = {}) ⇒ StompHandlerNull
constructor
A new instance of StompHandlerNull.
- #insert_fake(message) ⇒ Object
- #listen(queue, logid = "") ⇒ Object
- #listen_with_timeout(queue, timeout, logid = "") ⇒ Object
- #respond_error(nebMess, err, fields = [], logid = "") ⇒ Object
- #respond_success(nebMess, logid = "") ⇒ Object
- #send_message(queue, nebMess, logid = "") ⇒ Object
- #stomp_connect(logid = "") ⇒ Object
- #stomp_disconnect(logid = "") ⇒ Object
Methods inherited from StompHandler
Constructor Details
#initialize(hash = {}) ⇒ StompHandlerNull
Returns a new instance of StompHandlerNull.
19 20 21 22 |
# File 'lib/nebulous_stomp/stomp_handler_null.rb', line 19 def initialize(hash={}) super(hash) = [] end |
Instance Attribute Details
#fake_messages ⇒ Object (readonly)
Returns the value of attribute fake_messages.
17 18 19 |
# File 'lib/nebulous_stomp/stomp_handler_null.rb', line 17 def end |
Instance Method Details
#calc_reply_id ⇒ Object
76 |
# File 'lib/nebulous_stomp/stomp_handler_null.rb', line 76 def calc_reply_id; 'ABCD123456789'; end |
#connected? ⇒ Boolean
52 53 54 |
# File 'lib/nebulous_stomp/stomp_handler_null.rb', line 52 def connected? != [] end |
#insert_fake(message) ⇒ Object
24 25 26 |
# File 'lib/nebulous_stomp/stomp_handler_null.rb', line 24 def insert_fake() << end |
#listen(queue, logid = "") ⇒ Object
56 57 58 59 |
# File 'lib/nebulous_stomp/stomp_handler_null.rb', line 56 def listen(queue, logid="") NebulousStomp.logger.info(__FILE__) {log_helper logid, "Subscribing to #{queue} (on Null)"} .each{|m| yield m } end |
#listen_with_timeout(queue, timeout, logid = "") ⇒ Object
61 62 63 64 65 66 67 68 69 70 |
# File 'lib/nebulous_stomp/stomp_handler_null.rb', line 61 def listen_with_timeout(queue, timeout, logid="") NebulousStomp.logger.info(__FILE__) {log_helper logid, "Subscribing to #{queue} (on Null)"} if != [] .each{|m| yield m } else sleep timeout raise NebulousStomp::NebulousTimeout end end |
#respond_error(nebMess, err, fields = [], logid = "") ⇒ Object
34 35 36 37 38 |
# File 'lib/nebulous_stomp/stomp_handler_null.rb', line 34 def respond_error(nebMess,err,fields=[], logid="") NebulousStomp.logger.info(__FILE__) do log_helper logid, "Responded to #{nebMess} with 'error' verb: #{err} (to Null)" end end |
#respond_success(nebMess, logid = "") ⇒ Object
28 29 30 31 32 |
# File 'lib/nebulous_stomp/stomp_handler_null.rb', line 28 def respond_success(nebMess, logid="") NebulousStomp.logger.info(__FILE__) do log_helper logid, "Responded to #{nebMess} with 'success' verb (to Null)" end end |
#send_message(queue, nebMess, logid = "") ⇒ Object
72 73 74 |
# File 'lib/nebulous_stomp/stomp_handler_null.rb', line 72 def (queue, nebMess, logid="") nebMess end |
#stomp_connect(logid = "") ⇒ Object
40 41 42 43 44 |
# File 'lib/nebulous_stomp/stomp_handler_null.rb', line 40 def stomp_connect(logid="") NebulousStomp.logger.info(__FILE__) {log_helper logid, "Connecting to STOMP (Null)"} @client = true self end |
#stomp_disconnect(logid = "") ⇒ Object
46 47 48 49 50 |
# File 'lib/nebulous_stomp/stomp_handler_null.rb', line 46 def stomp_disconnect(logid="") NebulousStomp.logger.info(__FILE__) {log_helper logid, "STOMP Disconnect (Null)"} @client = nil self end |