Class: TorqueBox::Messaging::Queue

Inherits:
Destination show all
Defined in:
messaging/lib/torquebox/messaging/queue.rb

Constant Summary

Constant Summary

Constants inherited from Destination

Destination::PRIORITY_MAP

Instance Attribute Summary

Attributes inherited from Destination

#:connect_options, #:connection_factory, #:enumerable_options, #:java_destination, #:name

Class Method Summary (collapse)

Instance Method Summary (collapse)

Methods inherited from Destination

#_dump, _load, #each, #enumerable_options, #initialize, list, lookup, #normalize_options, #publish, #receive, #stop, #stop_sync, #wait_for_destination, wait_for_latch, with_destinationizer, #with_session

Constructor Details

This class inherits a constructor from TorqueBox::Messaging::Destination

Class Method Details

+ (Object) start(name, options = {})



36
37
38
39
40
41
42
43
44
45
46
# File 'messaging/lib/torquebox/messaging/queue.rb', line 36

def start(name, options={})
  selector = options.fetch(:selector, "")
  durable = options.fetch(:durable, true)
  exported = options.fetch(:exported, false)

  with_destinationizer do |destinationizer|
    destinationizer.create_queue(name, durable, selector, exported)
  end

  new(name, options)
end

Instance Method Details

- (Object) consumer_count



189
190
191
192
193
# File 'messaging/lib/torquebox/messaging/queue.rb', line 189

def consumer_count
  with_queue_control do |control|
    control.consumer_count
  end
end

- (Object) count_messages(filter = nil)



140
141
142
143
144
# File 'messaging/lib/torquebox/messaging/queue.rb', line 140

def count_messages(filter = nil)
  with_queue_control do |control|
    control.count_messages(filter)
  end
end

- (Object) dead_letter_address



266
267
268
269
270
# File 'messaging/lib/torquebox/messaging/queue.rb', line 266

def dead_letter_address
  with_queue_control do |control|
    control.dead_letter_address
  end
end

- (Object) dead_letter_address=(address)



287
288
289
290
291
292
293
# File 'messaging/lib/torquebox/messaging/queue.rb', line 287

def dead_letter_address=(address)
  with_queue_control do |control|
    control.set_dead_letter_address(address)
  end

  dead_letter_address
end

- (Object) expire_message(id)



160
161
162
163
164
# File 'messaging/lib/torquebox/messaging/queue.rb', line 160

def expire_message(id)
  with_queue_control do |control|
    control.expire_message(id)
  end
end

- (Object) expire_messages(filter = nil)



151
152
153
154
155
# File 'messaging/lib/torquebox/messaging/queue.rb', line 151

def expire_messages(filter = nil)
  with_queue_control do |control|
    control.expire_messages(filter)
  end
end

- (Object) expiry_address



234
235
236
237
238
# File 'messaging/lib/torquebox/messaging/queue.rb', line 234

def expiry_address
  with_queue_control do |control|
    control.expiry_address
  end
end

- (Object) expiry_address=(address)



255
256
257
258
259
260
261
# File 'messaging/lib/torquebox/messaging/queue.rb', line 255

def expiry_address=(address)
  with_queue_control do |control|
    control.set_expiry_address(address)
  end

  expiry_address
end

- (Object) move_message(queue_name, id, reject_duplicates = false)



225
226
227
228
229
# File 'messaging/lib/torquebox/messaging/queue.rb', line 225

def move_message(queue_name, id, reject_duplicates = false)
  with_queue_control do |control|
    control.move_message(id, queue_name, reject_duplicates)
  end
end

- (Object) move_messages(queue_name, filter = nil, reject_duplicates = false)



212
213
214
215
216
# File 'messaging/lib/torquebox/messaging/queue.rb', line 212

def move_messages(queue_name, filter = nil, reject_duplicates = false)
  with_queue_control do |control|
    control.move_messages(filter, queue_name, reject_duplicates)
  end
end

- (Object) pause



90
91
92
93
94
# File 'messaging/lib/torquebox/messaging/queue.rb', line 90

def pause
  with_queue_control do |control|
    control.pause
  end
end

- (Boolean) paused?

Returns:

  • (Boolean)


76
77
78
79
80
# File 'messaging/lib/torquebox/messaging/queue.rb', line 76

def paused?
  with_queue_control do |control|
    control.is_paused
  end
end

- (Object) publish_and_receive(message, options = {})



54
55
56
57
58
59
60
61
# File 'messaging/lib/torquebox/messaging/queue.rb', line 54

def publish_and_receive(message, options={})
  result = nil
  with_session do |session|
    result = session.publish_and_receive(self, message,
                                         normalize_options(options))
  end
  result
end

- (Object) receive_and_publish(options = {}, &block)



68
69
70
71
72
# File 'messaging/lib/torquebox/messaging/queue.rb', line 68

def receive_and_publish(options={}, &block)
  with_session do |session|
    session.receive_and_publish(self, normalize_options(options), &block)
  end
end

- (Object) remove_message(id)



125
126
127
128
129
# File 'messaging/lib/torquebox/messaging/queue.rb', line 125

def remove_message(id)
  with_queue_control do |control|
    control.remove_message(id)
  end
end

- (Object) remove_messages(filter = nil)



115
116
117
118
119
# File 'messaging/lib/torquebox/messaging/queue.rb', line 115

def remove_messages(filter = nil)
  with_queue_control do |control|
    control.remove_messages(filter)
  end
end

- (Object) resume



100
101
102
103
104
# File 'messaging/lib/torquebox/messaging/queue.rb', line 100

def resume
  with_queue_control do |control|
    control.resume
  end
end

- (Object) scheduled_messages_count



198
199
200
201
202
# File 'messaging/lib/torquebox/messaging/queue.rb', line 198

def scheduled_messages_count
  with_queue_control do |control|
    control.scheduled_count
  end
end

- (Object) send_message_to_dead_letter_address(id)



169
170
171
172
173
# File 'messaging/lib/torquebox/messaging/queue.rb', line 169

def send_message_to_dead_letter_address(id)
  with_queue_control do |control|
    control.send_message_to_dead_letter_address(id)
  end
end

- (Object) send_messages_to_dead_letter_address(filter = nil)



180
181
182
183
184
# File 'messaging/lib/torquebox/messaging/queue.rb', line 180

def send_messages_to_dead_letter_address(filter = nil)
  with_queue_control do |control|
    control.send_messages_to_dead_letter_address(filter)
  end
end

- (Object) to_s



296
297
298
# File 'messaging/lib/torquebox/messaging/queue.rb', line 296

def to_s
  "[Queue: #{super}]"
end

- (Object) with_queue_control



304
305
306
307
308
# File 'messaging/lib/torquebox/messaging/queue.rb', line 304

def with_queue_control
  TorqueBox::ServiceRegistry.lookup("jboss.messaging.default") do |server|
    yield server.management_service.get_resource("jms.queue.#{@name}")
  end
end