Class: TorqueBox::Messaging::MessageProcessorProxy

Inherits:
Object
  • Object
show all
Defined in:
lib/torquebox/messaging/message_processor.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_nameObject (readonly)

Returns the message processor implementation class name

Returns:

  • String



154
155
156
# File 'lib/torquebox/messaging/message_processor.rb', line 154

def class_name
  @class_name
end

#destination_nameObject (readonly)

Returns the destination (queue or topic) name

Returns:

  • String



146
147
148
# File 'lib/torquebox/messaging/message_processor.rb', line 146

def destination_name
  @destination_name
end

Instance Method Details

#concurrencyObject

Returns the concurrency

Returns:

  • Integer



132
133
134
# File 'lib/torquebox/messaging/message_processor.rb', line 132

def concurrency
  @group.concurrency
end

#concurrency=(size) ⇒ Object

Note:

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

Returns:

  • (Boolean)

    Boolean



172
173
174
# File 'lib/torquebox/messaging/message_processor.rb', line 172

def durable?
  @group.durable
end

#message_selectorObject

Returns the message selector

If there is no message selector specified, returns empty string

Returns:

  • String



164
165
166
# File 'lib/torquebox/messaging/message_processor.rb', line 164

def message_selector
  @group.message_selector
end

#nameObject

Returns the group name

Returns:

  • String



139
140
141
# File 'lib/torquebox/messaging/message_processor.rb', line 139

def name
  @group.name
end

#startObject

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

Returns:

  • (Boolean)

    Boolean



188
189
190
# File 'lib/torquebox/messaging/message_processor.rb', line 188

def started?
  @group.status.eql?("STARTED")
end

#stopObject

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

Returns:

  • (Boolean)

    Boolean



180
181
182
# File 'lib/torquebox/messaging/message_processor.rb', line 180

def synchronous?
  @group.synchronous
end

#to_sObject



204
205
206
# File 'lib/torquebox/messaging/message_processor.rb', line 204

def to_s
  "<MessageProcessorProxy: #{name}>"
end