Class: NebulousStomp::Target
- Inherits:
-
Object
- Object
- NebulousStomp::Target
- Defined in:
- lib/nebulous_stomp/target.rb
Overview
Represents a single Target. Read only.
NebulousStomp.add_target returns a Target, or you can retreive one from the config using NebulousStomp.get_target.
Constant Summary collapse
- VALID_KEYS =
%i|sendQueue receiveQueue messageTimeout name|
Instance Attribute Summary collapse
-
#message_timeout ⇒ Object
readonly
The message timeout for the queue.
-
#name ⇒ Object
readonly
The identifying name of the queue.
-
#receive_queue ⇒ Object
readonly
The queue that the target listens for requests on.
-
#send_queue ⇒ Object
readonly
The queue that the target sends responses to.
Instance Method Summary collapse
-
#initialize(hash) ⇒ Target
constructor
Create a target.
Constructor Details
#initialize(hash) ⇒ Target
Create a target.
Valid keys for the hash:
* :sendQueue
* :receiveQeue
* :name
* :messageTimeout (optional)
36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/nebulous_stomp/target.rb', line 36 def initialize(hash) fail ArgumentError, "Argument for Target.new must be a hash" unless hash.is_a? Hash @send_queue = hash[:sendQueue] or fail ArgumentError, "Missing a sendQueue" @receive_queue = hash[:receiveQueue] or fail ArgumentError, "Missing a receiveQueue" @name = hash[:name] or fail ArgumentError, "Missing a name" @message_timeout = hash[:messageTimeout] bad_keys = hash.reject{|k, _| VALID_KEYS.include? k }.keys fail ArgumentError, "Bad keys: #{bad_keys.join ' '}" unless bad_keys.empty? end |
Instance Attribute Details
#message_timeout ⇒ Object (readonly)
The message timeout for the queue
22 23 24 |
# File 'lib/nebulous_stomp/target.rb', line 22 def @message_timeout end |
#name ⇒ Object (readonly)
The identifying name of the queue
13 14 15 |
# File 'lib/nebulous_stomp/target.rb', line 13 def name @name end |
#receive_queue ⇒ Object (readonly)
The queue that the target listens for requests on
19 20 21 |
# File 'lib/nebulous_stomp/target.rb', line 19 def receive_queue @receive_queue end |
#send_queue ⇒ Object (readonly)
The queue that the target sends responses to
16 17 18 |
# File 'lib/nebulous_stomp/target.rb', line 16 def send_queue @send_queue end |