Class: TorqueBox::Messaging::MessageProcessorProxy
- Inherits:
-
Object
- Object
- TorqueBox::Messaging::MessageProcessorProxy
- Defined in:
- lib/torquebox/messaging/message_processor.rb
Instance Attribute Summary collapse
-
#class_name ⇒ Object
readonly
Returns the message processor implementation class name.
-
#destination_name ⇒ Object
readonly
Returns the destination (queue or topic) name.
Instance Method Summary collapse
-
#concurrency ⇒ Object
Returns the concurrency.
-
#concurrency=(size) ⇒ Object
Updates the concurrency,.
-
#durable? ⇒ Boolean
Returns true if the message processor is a durable subscriber, false otherwise.
-
#initialize(group) ⇒ MessageProcessorProxy
constructor
A new instance of MessageProcessorProxy.
-
#message_selector ⇒ Object
Returns the message selector.
-
#name ⇒ Object
Returns the group name.
-
#start ⇒ Object
Starts the message processor.
-
#started? ⇒ Boolean
Returns true if the message processor is started, false otherwise.
-
#stop ⇒ Object
Stops the message processor.
-
#synchronous? ⇒ Boolean
Returns true if the message processor is synchronous, false otherwise.
- #to_s ⇒ Object
Constructor Details
#initialize(group) ⇒ MessageProcessorProxy
Returns a new instance of MessageProcessorProxy.
107 108 109 110 111 |
# File 'lib/torquebox/messaging/message_processor.rb', line 107 def initialize(group) @group = group raise "Cannot create MessageProcessorProxy for non-existing MessageProcessorGroup" if @group.nil? end |
Instance Attribute Details
#class_name ⇒ Object (readonly)
Returns the message processor implementation class name
154 155 156 |
# File 'lib/torquebox/messaging/message_processor.rb', line 154 def class_name @class_name end |
#destination_name ⇒ Object (readonly)
Returns the destination (queue or topic) name
146 147 148 |
# File 'lib/torquebox/messaging/message_processor.rb', line 146 def destination_name @destination_name end |
Instance Method Details
#concurrency ⇒ Object
Returns the concurrency
132 133 134 |
# File 'lib/torquebox/messaging/message_processor.rb', line 132 def concurrency @group.concurrency end |
#concurrency=(size) ⇒ Object
This method sets the concurrency and changes immediately the number of consumers for specified destination.
Updates the concurrency,
119 120 121 122 123 124 125 126 127 |
# File 'lib/torquebox/messaging/message_processor.rb', line 119 def concurrency=(size) raise "Setting concurrency for '#{name}' to value < 0 is not allowed. You tried '#{size}'." if size < 0 return size if size == @group.concurrency @group.update_concurrency(size) concurrency end |
#durable? ⇒ Boolean
Returns true if the message processor is a durable subscriber, false otherwise
172 173 174 |
# File 'lib/torquebox/messaging/message_processor.rb', line 172 def durable? @group.durable end |
#message_selector ⇒ Object
Returns the message selector
If there is no message selector specified, returns empty string
164 165 166 |
# File 'lib/torquebox/messaging/message_processor.rb', line 164 def @group. end |
#name ⇒ Object
Returns the group name
139 140 141 |
# File 'lib/torquebox/messaging/message_processor.rb', line 139 def name @group.name end |
#start ⇒ Object
Starts the message processor
194 195 196 |
# File 'lib/torquebox/messaging/message_processor.rb', line 194 def start @group.start end |
#started? ⇒ Boolean
Returns true if the message processor is started, false otherwise
188 189 190 |
# File 'lib/torquebox/messaging/message_processor.rb', line 188 def started? @group.status.eql?("STARTED") end |
#stop ⇒ Object
Stops the message processor
200 201 202 |
# File 'lib/torquebox/messaging/message_processor.rb', line 200 def stop @group.stop end |
#synchronous? ⇒ Boolean
Returns true if the message processor is synchronous, false otherwise
180 181 182 |
# File 'lib/torquebox/messaging/message_processor.rb', line 180 def synchronous? @group.synchronous end |
#to_s ⇒ Object
204 205 206 |
# File 'lib/torquebox/messaging/message_processor.rb', line 204 def to_s "<MessageProcessorProxy: #{name}>" end |