march_hare 2.0.0.rc3-java → 2.0.0.rc4-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ext/rabbitmq-client.jar +0 -0
- data/lib/march_hare/channel.rb +42 -42
- data/lib/march_hare/exchange.rb +23 -21
- data/lib/march_hare/queue.rb +15 -15
- data/lib/march_hare/session.rb +5 -5
- data/lib/march_hare/version.rb +1 -1
- metadata +2 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2f065caf463f688b529731afb0836d0e82f521df
|
4
|
+
data.tar.gz: 4eea56b6d2f68dfa448770b844a084a34f4e8661
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 94d6f44bba40d0b97299f02f856a9f8fea49b50ed007c2c8e67daaa1ec7d573447d3b8ff6144df74611adf6690fbcb1a9888b8baaf5f069e96335f7a0118e9a0
|
7
|
+
data.tar.gz: be9226fe597a26584fd7099c9f1d23a421778fb65077605cea34c616712d10a306333a458c7ca0806b980016788d33645102cf256b288775e22f42bafca43cc3
|
data/lib/ext/rabbitmq-client.jar
CHANGED
Binary file
|
data/lib/march_hare/channel.rb
CHANGED
@@ -98,7 +98,7 @@ module MarchHare
|
|
98
98
|
# @example Handling 406 PRECONDITION_FAILED
|
99
99
|
# begin
|
100
100
|
# ch2 = conn.create_channel
|
101
|
-
# q = "
|
101
|
+
# q = "rubymarchhare.examples.recovery.q#{rand}"
|
102
102
|
#
|
103
103
|
# ch2.queue_declare(q, :durable => false)
|
104
104
|
# ch2.queue_declare(q, :durable => true)
|
@@ -110,9 +110,9 @@ module MarchHare
|
|
110
110
|
#
|
111
111
|
# @see MarchHare::Session#create_channel
|
112
112
|
# @see http://www.rabbitmq.com/tutorials/amqp-concepts.html AMQP 0.9.1 Model Concepts Guide
|
113
|
-
# @see http://
|
114
|
-
# @see http://
|
115
|
-
# @see http://
|
113
|
+
# @see http://rubymarchhare.info/articles/getting_started.html Getting Started with RabbitMQ Using MarchHare
|
114
|
+
# @see http://rubymarchhare.info/articles/queues.html Queues and Consumers
|
115
|
+
# @see http://rubymarchhare.info/articles/exchanges.html Exchanges and Publishing
|
116
116
|
class Channel
|
117
117
|
# @return [Array<MarchHare::Consumer>] Consumers on this channel
|
118
118
|
attr_reader :consumers
|
@@ -260,8 +260,8 @@ module MarchHare
|
|
260
260
|
# @option options [Hash] :arguments ({}) Optional exchange arguments
|
261
261
|
#
|
262
262
|
# @return [MarchHare::Exchange] Exchange instance
|
263
|
-
# @see http://
|
264
|
-
# @see http://
|
263
|
+
# @see http://rubymarchhare.info/articles/exchanges.html Exchanges and Publishing guide
|
264
|
+
# @see http://rubymarchhare.info/articles/extensions.html RabbitMQ Extensions to AMQP 0.9.1 guide
|
265
265
|
def exchange(name, options={})
|
266
266
|
dx = Exchange.new(self, name, options).tap do |x|
|
267
267
|
x.declare!
|
@@ -281,8 +281,8 @@ module MarchHare
|
|
281
281
|
# @option opts [Hash] :arguments ({}) Optional exchange arguments (used by RabbitMQ extensions)
|
282
282
|
#
|
283
283
|
# @return [MarchHare::Exchange] Exchange instance
|
284
|
-
# @see http://
|
285
|
-
# @see http://
|
284
|
+
# @see http://rubymarchhare.info/articles/exchanges.html Exchanges and Publishing guide
|
285
|
+
# @see http://rubymarchhare.info/articles/extensions.html RabbitMQ Extensions to AMQP 0.9.1 guide
|
286
286
|
def fanout(name, opts = {})
|
287
287
|
dx = Exchange.new(self, name, opts.merge(:type => "fanout")).tap do |x|
|
288
288
|
x.declare!
|
@@ -302,8 +302,8 @@ module MarchHare
|
|
302
302
|
# @option opts [Hash] :arguments ({}) Optional exchange arguments (used by RabbitMQ extensions)
|
303
303
|
#
|
304
304
|
# @return [MarchHare::Exchange] Exchange instance
|
305
|
-
# @see http://
|
306
|
-
# @see http://
|
305
|
+
# @see http://rubymarchhare.info/articles/exchanges.html Exchanges and Publishing guide
|
306
|
+
# @see http://rubymarchhare.info/articles/extensions.html RabbitMQ Extensions to AMQP 0.9.1 guide
|
307
307
|
def direct(name, opts = {})
|
308
308
|
dx = Exchange.new(self, name, opts.merge(:type => "direct")).tap do |x|
|
309
309
|
x.declare!
|
@@ -323,8 +323,8 @@ module MarchHare
|
|
323
323
|
# @option opts [Hash] :arguments ({}) Optional exchange arguments (used by RabbitMQ extensions)
|
324
324
|
#
|
325
325
|
# @return [MarchHare::Exchange] Exchange instance
|
326
|
-
# @see http://
|
327
|
-
# @see http://
|
326
|
+
# @see http://rubymarchhare.info/articles/exchanges.html Exchanges and Publishing guide
|
327
|
+
# @see http://rubymarchhare.info/articles/extensions.html RabbitMQ Extensions to AMQP 0.9.1 guide
|
328
328
|
def topic(name, opts = {})
|
329
329
|
dx = Exchange.new(self, name, opts.merge(:type => "topic")).tap do |x|
|
330
330
|
x.declare!
|
@@ -344,8 +344,8 @@ module MarchHare
|
|
344
344
|
# @option opts [Hash] :arguments ({}) Optional exchange arguments
|
345
345
|
#
|
346
346
|
# @return [MarchHare::Exchange] Exchange instance
|
347
|
-
# @see http://
|
348
|
-
# @see http://
|
347
|
+
# @see http://rubymarchhare.info/articles/exchanges.html Exchanges and Publishing guide
|
348
|
+
# @see http://rubymarchhare.info/articles/extensions.html RabbitMQ Extensions to AMQP 0.9.1 guide
|
349
349
|
def headers(name, opts = {})
|
350
350
|
dx = Exchange.new(self, name, opts.merge(:type => "headers")).tap do |x|
|
351
351
|
x.declare!
|
@@ -355,7 +355,7 @@ module MarchHare
|
|
355
355
|
end
|
356
356
|
|
357
357
|
# Provides access to the default exchange
|
358
|
-
# @see http://
|
358
|
+
# @see http://rubymarchhare.info/articles/exchanges.html Exchanges and Publishing guide
|
359
359
|
def default_exchange
|
360
360
|
@default_exchange ||= self.exchange("", :durable => true, :auto_delete => false, :type => "direct")
|
361
361
|
end
|
@@ -370,7 +370,7 @@ module MarchHare
|
|
370
370
|
# exist, {MarchHare::NotFound} will be raised.
|
371
371
|
#
|
372
372
|
# @return RabbitMQ response
|
373
|
-
# @see http://
|
373
|
+
# @see http://rubymarchhare.info/articles/echanges.html Exchanges and Publishing guide
|
374
374
|
def exchange_declare(name, type, durable = false, auto_delete = false, arguments = nil)
|
375
375
|
@delegate.exchange_declare(name, type, durable, auto_delete, arguments)
|
376
376
|
end
|
@@ -384,8 +384,8 @@ module MarchHare
|
|
384
384
|
# @param [Hash] arguments (nil) Optional arguments
|
385
385
|
#
|
386
386
|
# @return RabbitMQ response
|
387
|
-
# @see http://
|
388
|
-
# @see http://
|
387
|
+
# @see http://rubymarchhare.info/articles/extensions.html RabbitMQ extensions guide
|
388
|
+
# @see http://rubymarchhare.info/articles/bindings.html Bindings guide
|
389
389
|
def exchange_bind(destination, source, routing_key, arguments = nil)
|
390
390
|
@delegate.exchange_bind(destination, source, routing_key, arguments)
|
391
391
|
end
|
@@ -399,8 +399,8 @@ module MarchHare
|
|
399
399
|
# @param [Hash] arguments ({}) Optional arguments
|
400
400
|
#
|
401
401
|
# @return RabbitMQ response
|
402
|
-
# @see http://
|
403
|
-
# @see http://
|
402
|
+
# @see http://rubymarchhare.info/articles/extensions.html RabbitMQ extensions guide
|
403
|
+
# @see http://rubymarchhare.info/articles/bindings.html Bindings guide
|
404
404
|
def exchange_unbind(destination, source, routing_key, arguments = nil)
|
405
405
|
@delegate.exchange_unbind(destination, source, routing_key, arguments)
|
406
406
|
end
|
@@ -421,8 +421,8 @@ module MarchHare
|
|
421
421
|
# @option options [Boolean] :arguments ({}) Additional optional arguments (typically used by RabbitMQ extensions and plugins)
|
422
422
|
#
|
423
423
|
# @return [MarchHare::Queue] Queue that was declared or looked up in the cache
|
424
|
-
# @see http://
|
425
|
-
# @see http://
|
424
|
+
# @see http://rubymarchhare.info/articles/queues.html Queues and Consumers guide
|
425
|
+
# @see http://rubymarchhare.info/articles/extensions.html RabbitMQ Extensions guide
|
426
426
|
def queue(name, options={})
|
427
427
|
dq = Queue.new(self, name, options).tap do |q|
|
428
428
|
q.declare!
|
@@ -445,7 +445,7 @@ module MarchHare
|
|
445
445
|
# exist, {MarchHare::NotFound} will be raised.
|
446
446
|
#
|
447
447
|
# @return RabbitMQ response
|
448
|
-
# @see http://
|
448
|
+
# @see http://rubymarchhare.info/articles/queues.html Queues and Consumers guide
|
449
449
|
def queue_declare(name, durable, exclusive, auto_delete, arguments = {})
|
450
450
|
converting_rjc_exceptions_to_ruby do
|
451
451
|
@delegate.queue_declare(name, durable, exclusive, auto_delete, arguments)
|
@@ -457,7 +457,7 @@ module MarchHare
|
|
457
457
|
#
|
458
458
|
# @param [String] name Queue name
|
459
459
|
#
|
460
|
-
# @see http://
|
460
|
+
# @see http://rubymarchhare.info/articles/queues.html Queues and Consumers guide
|
461
461
|
def queue_declare_passive(name)
|
462
462
|
converting_rjc_exceptions_to_ruby do
|
463
463
|
@delegate.queue_declare_passive(name)
|
@@ -472,7 +472,7 @@ module MarchHare
|
|
472
472
|
# @param [Boolean] if_unused (false) Should this queue be deleted only if it has no consumers?
|
473
473
|
#
|
474
474
|
# @return RabbitMQ response
|
475
|
-
# @see http://
|
475
|
+
# @see http://rubymarchhare.info/articles/queues.html Queues and Consumers guide
|
476
476
|
def queue_delete(name, if_empty = false, if_unused = false)
|
477
477
|
converting_rjc_exceptions_to_ruby do
|
478
478
|
@delegate.queue_delete(name, if_empty, if_unused)
|
@@ -488,8 +488,8 @@ module MarchHare
|
|
488
488
|
# @param [Hash] arguments (nil) Optional arguments
|
489
489
|
#
|
490
490
|
# @return RabbitMQ response
|
491
|
-
# @see http://
|
492
|
-
# @see http://
|
491
|
+
# @see http://rubymarchhare.info/articles/queues.html Queues and Consumers guide
|
492
|
+
# @see http://rubymarchhare.info/articles/bindings.html Bindings guide
|
493
493
|
def queue_bind(queue, exchange, routing_key, arguments = nil)
|
494
494
|
converting_rjc_exceptions_to_ruby do
|
495
495
|
@delegate.queue_bind(queue, exchange, routing_key, arguments)
|
@@ -505,8 +505,8 @@ module MarchHare
|
|
505
505
|
# @param [Hash] arguments ({}) Optional arguments
|
506
506
|
#
|
507
507
|
# @return RabbitMQ response
|
508
|
-
# @see http://
|
509
|
-
# @see http://
|
508
|
+
# @see http://rubymarchhare.info/articles/queues.html Queues and Consumers guide
|
509
|
+
# @see http://rubymarchhare.info/articles/bindings.html Bindings guide
|
510
510
|
def queue_unbind(queue, exchange, routing_key, arguments = nil)
|
511
511
|
converting_rjc_exceptions_to_ruby do
|
512
512
|
@delegate.queue_unbind(queue, exchange, routing_key, arguments)
|
@@ -518,7 +518,7 @@ module MarchHare
|
|
518
518
|
# @param [String] name Queue name
|
519
519
|
#
|
520
520
|
# @return RabbitMQ response
|
521
|
-
# @see http://
|
521
|
+
# @see http://rubymarchhare.info/articles/queues.html Queues and Consumers guide
|
522
522
|
def queue_purge(name)
|
523
523
|
converting_rjc_exceptions_to_ruby do
|
524
524
|
@delegate.queue_purge(name)
|
@@ -595,8 +595,8 @@ module MarchHare
|
|
595
595
|
# have to acknowledge or reject one of the previously consumed messages
|
596
596
|
#
|
597
597
|
# @param [Integer] prefetch_count Prefetch (QoS setting) for this channel
|
598
|
-
# @see http://
|
599
|
-
# @see http://
|
598
|
+
# @see http://rubymarchhare.info/articles/exchanges.html Exchanges and Publishing guide
|
599
|
+
# @see http://rubymarchhare.info/articles/queues.html Queues and Consumers guide
|
600
600
|
def prefetch=(n)
|
601
601
|
basic_qos(n)
|
602
602
|
end
|
@@ -606,7 +606,7 @@ module MarchHare
|
|
606
606
|
# @param [Integer] delivery_tag Delivery tag to acknowledge
|
607
607
|
# @param [Boolean] multiple (false) Should all unacknowledged messages up to this be acknowledged as well?
|
608
608
|
# @see #nack
|
609
|
-
# @see http://
|
609
|
+
# @see http://rubymarchhare.info/articles/queues.html Queues and Consumers guide
|
610
610
|
def ack(delivery_tag, multiple = false)
|
611
611
|
guarding_against_stale_delivery_tags(delivery_tag) do
|
612
612
|
basic_ack(delivery_tag.to_i, multiple)
|
@@ -621,7 +621,7 @@ module MarchHare
|
|
621
621
|
# @param [Boolean] requeue Should this message be requeued instead of dropping it?
|
622
622
|
# @see #ack
|
623
623
|
# @see #nack
|
624
|
-
# @see http://
|
624
|
+
# @see http://rubymarchhare.info/articles/queues.html Queues and Consumers guide
|
625
625
|
def reject(delivery_tag, requeue = false)
|
626
626
|
guarding_against_stale_delivery_tags(delivery_tag) do
|
627
627
|
basic_reject(delivery_tag.to_i, requeue)
|
@@ -636,7 +636,7 @@ module MarchHare
|
|
636
636
|
# @param [Boolean] multiple (false) Should all unacknowledged messages up to this be rejected as well?
|
637
637
|
# @param [Boolean] requeue (false) Should this message be requeued instead of dropping it?
|
638
638
|
# @see #ack
|
639
|
-
# @see http://
|
639
|
+
# @see http://rubymarchhare.info/articles/queues.html Queues and Consumers guide
|
640
640
|
def nack(delivery_tag, multiple = false, requeue = false)
|
641
641
|
guarding_against_stale_delivery_tags(delivery_tag) do
|
642
642
|
basic_nack(delivery_tag.to_i, multiple, requeue)
|
@@ -679,7 +679,7 @@ module MarchHare
|
|
679
679
|
# ch.basic_reject(delivery_info.delivery_tag, true)
|
680
680
|
#
|
681
681
|
# @see #basic_nack
|
682
|
-
# @see http://
|
682
|
+
# @see http://rubymarchhare.info/articles/queues.html Queues and Consumers guide
|
683
683
|
def basic_reject(delivery_tag, requeue)
|
684
684
|
converting_rjc_exceptions_to_ruby do
|
685
685
|
@delegate.basic_reject(delivery_tag.to_i, requeue)
|
@@ -692,7 +692,7 @@ module MarchHare
|
|
692
692
|
# @param [Boolean] multiple Should all deliveries up to this one be acknowledged?
|
693
693
|
# @return [NilClass] nil
|
694
694
|
#
|
695
|
-
# @see http://
|
695
|
+
# @see http://rubymarchhare.info/articles/queues.html Queues and Consumers guide
|
696
696
|
def basic_ack(delivery_tag, multiple)
|
697
697
|
converting_rjc_exceptions_to_ruby do
|
698
698
|
@delegate.basic_ack(delivery_tag.to_i, multiple)
|
@@ -707,8 +707,8 @@ module MarchHare
|
|
707
707
|
# @param [Boolean] multiple Should all deliveries up to this one be rejected/requeued?
|
708
708
|
# @return [NilClass] nil
|
709
709
|
#
|
710
|
-
# @see http://
|
711
|
-
# @see http://
|
710
|
+
# @see http://rubymarchhare.info/articles/queues.html Queues and Consumers guide
|
711
|
+
# @see http://rubymarchhare.info/articles/extensions.html RabbitMQ Extensions guide
|
712
712
|
def basic_nack(delivery_tag, multiple = false, requeue = false)
|
713
713
|
converting_rjc_exceptions_to_ruby do
|
714
714
|
@delegate.basic_nack(delivery_tag.to_i, multiple, requeue)
|
@@ -740,8 +740,8 @@ module MarchHare
|
|
740
740
|
# Enables publisher confirms on the channel.
|
741
741
|
# @return [NilClass] nil
|
742
742
|
#
|
743
|
-
# @see http://
|
744
|
-
# @see http://
|
743
|
+
# @see http://rubymarchhare.info/articles/exchanges.html Exchanges and Publishers guide
|
744
|
+
# @see http://rubymarchhare.info/articles/extensions.html RabbitMQ Extensions guide
|
745
745
|
def confirm_select
|
746
746
|
converting_rjc_exceptions_to_ruby do
|
747
747
|
@delegate.confirm_select
|
@@ -800,7 +800,7 @@ module MarchHare
|
|
800
800
|
end
|
801
801
|
|
802
802
|
# Defines a returned message handler.
|
803
|
-
# @see http://
|
803
|
+
# @see http://rubymarchhare.info/articles/exchanges.html Exchanges and Publishers guide
|
804
804
|
def on_return(&block)
|
805
805
|
self.add_return_listener(BlockReturnListener.from(block))
|
806
806
|
end
|
data/lib/march_hare/exchange.rb
CHANGED
@@ -5,8 +5,8 @@ module MarchHare
|
|
5
5
|
|
6
6
|
# Represents AMQP 0.9.1 exchanges.
|
7
7
|
#
|
8
|
-
# @see http://
|
9
|
-
# @see http://
|
8
|
+
# @see http://rubymarchhare.info/articles/exchanges.html Exchanges and Publishing guide
|
9
|
+
# @see http://rubymarchhare.info/articles/extensions.html RabbitMQ Extensions guide
|
10
10
|
class Exchange
|
11
11
|
# @return [String] Exchange name
|
12
12
|
attr_reader :name
|
@@ -36,20 +36,22 @@ module MarchHare
|
|
36
36
|
# @option opts [String] :routing_key Routing key
|
37
37
|
# @option opts [Boolean] :persistent Should the message be persisted to disk?
|
38
38
|
# @option opts [Boolean] :mandatory Should the message be returned if it cannot be routed to any queue?
|
39
|
-
# @option opts [
|
40
|
-
#
|
41
|
-
#
|
42
|
-
#
|
43
|
-
#
|
44
|
-
#
|
45
|
-
#
|
46
|
-
#
|
47
|
-
#
|
48
|
-
#
|
49
|
-
#
|
39
|
+
# @option opts [Hash] :properties Messages and delivery properties
|
40
|
+
#
|
41
|
+
# * :timestamp (Integer) A timestamp associated with this message
|
42
|
+
# * :expiration (Integer) Expiration time after which the message will be deleted
|
43
|
+
# * :type (String) Message type, e.g. what type of event or command this message represents. Can be any string
|
44
|
+
# * :reply_to (String) Queue name other apps should send the response to
|
45
|
+
# * :content_type (String) Message content type (e.g. application/json)
|
46
|
+
# * :content_encoding (String) Message content encoding (e.g. gzip)
|
47
|
+
# * :correlation_id (String) Message correlated to this one, e.g. what request this message is a reply for
|
48
|
+
# * :priority (Integer) Message priority, 0 to 9. Not used by RabbitMQ, only applications
|
49
|
+
# * :message_id (String) Any message identifier
|
50
|
+
# * :user_id (String) Optional user ID. Verified by RabbitMQ against the actual connection username
|
51
|
+
# * :app_id (String) Optional application ID
|
50
52
|
#
|
51
53
|
# @return [MarchHare::Exchange] Self
|
52
|
-
# @see http://
|
54
|
+
# @see http://rubymarchhare.info/articles/exchanges.html Exchanges and Publishing guide
|
53
55
|
# @api public
|
54
56
|
def publish(body, opts = {})
|
55
57
|
options = {:routing_key => '', :mandatory => false}.merge(opts)
|
@@ -66,7 +68,7 @@ module MarchHare
|
|
66
68
|
#
|
67
69
|
# @option opts [Boolean] if_unused (false) Should this exchange be deleted only if it is no longer used
|
68
70
|
#
|
69
|
-
# @see http://
|
71
|
+
# @see http://rubymarchhare.info/articles/exchanges.html Exchanges and Publishing guide
|
70
72
|
# @api public
|
71
73
|
def delete(options={})
|
72
74
|
@channel.deregister_exchange(self)
|
@@ -83,9 +85,9 @@ module MarchHare
|
|
83
85
|
# @option opts [Hash] arguments ({}) Optional arguments
|
84
86
|
#
|
85
87
|
# @return [MarchHare::Exchange] Self
|
86
|
-
# @see http://
|
87
|
-
# @see http://
|
88
|
-
# @see http://
|
88
|
+
# @see http://rubymarchhare.info/articles/exchanges.html Exchanges and Publishing guide
|
89
|
+
# @see http://rubymarchhare.info/articles/bindings.html Bindings guide
|
90
|
+
# @see http://rubymarchhare.info/articles/extensions.html RabbitMQ Extensions guide
|
89
91
|
# @api public
|
90
92
|
def bind(exchange, options={})
|
91
93
|
exchange_name = if exchange.respond_to?(:name) then exchange.name else exchange.to_s end
|
@@ -102,9 +104,9 @@ module MarchHare
|
|
102
104
|
# @option opts [Hash] arguments ({}) Optional arguments
|
103
105
|
#
|
104
106
|
# @return [Bunny::Exchange] Self
|
105
|
-
# @see http://
|
106
|
-
# @see http://
|
107
|
-
# @see http://
|
107
|
+
# @see http://rubymarchhare.info/articles/exchanges.html Exchanges and Publishing guide
|
108
|
+
# @see http://rubymarchhare.info/articles/bindings.html Bindings guide
|
109
|
+
# @see http://rubymarchhare.info/articles/extensions.html RabbitMQ Extensions guide
|
108
110
|
# @api public
|
109
111
|
def unbind(exchange, opts = {})
|
110
112
|
exchange_name = if exchange.respond_to?(:name) then exchange.name else exchange.to_s end
|
data/lib/march_hare/queue.rb
CHANGED
@@ -8,8 +8,8 @@ require "set"
|
|
8
8
|
module MarchHare
|
9
9
|
# Represents AMQP 0.9.1 queue.
|
10
10
|
#
|
11
|
-
# @see http://
|
12
|
-
# @see http://
|
11
|
+
# @see http://rubymarchhare.info/articles/queues.html Queues and Consumers guide
|
12
|
+
# @see http://rubymarchhare.info/articles/extensions.html RabbitMQ Extensions guide
|
13
13
|
class Queue
|
14
14
|
# @return [MarchHare::Channel] Channel this queue uses
|
15
15
|
attr_reader :channel
|
@@ -26,8 +26,8 @@ module MarchHare
|
|
26
26
|
# @option opts [Boolean] :arguments ({}) Additional optional arguments (typically used by RabbitMQ extensions and plugins)
|
27
27
|
#
|
28
28
|
# @see MarchHare::Channel#queue
|
29
|
-
# @see http://
|
30
|
-
# @see http://
|
29
|
+
# @see http://rubymarchhare.info/articles/queues.html Queues and Consumers guide
|
30
|
+
# @see http://rubymarchhare.info/articles/extensions.html RabbitMQ Extensions guide
|
31
31
|
def initialize(channel, name, options={})
|
32
32
|
@channel = channel
|
33
33
|
@name = name
|
@@ -44,25 +44,25 @@ module MarchHare
|
|
44
44
|
|
45
45
|
|
46
46
|
# @return [Boolean] true if this queue was declared as durable (will survive broker restart).
|
47
|
-
# @see http://
|
47
|
+
# @see http://rubymarchhare.info/articles/queues.html Queues and Consumers guide
|
48
48
|
def durable?
|
49
49
|
@durable
|
50
50
|
end # durable?
|
51
51
|
|
52
52
|
# @return [Boolean] true if this queue was declared as exclusive (limited to just one consumer)
|
53
|
-
# @see http://
|
53
|
+
# @see http://rubymarchhare.info/articles/queues.html Queues and Consumers guide
|
54
54
|
def exclusive?
|
55
55
|
@exclusive
|
56
56
|
end # exclusive?
|
57
57
|
|
58
58
|
# @return [Boolean] true if this queue was declared as automatically deleted (deleted as soon as last consumer unbinds).
|
59
|
-
# @see http://
|
59
|
+
# @see http://rubymarchhare.info/articles/queues.html Queues and Consumers guide
|
60
60
|
def auto_delete?
|
61
61
|
@auto_delete
|
62
62
|
end # auto_delete?
|
63
63
|
|
64
64
|
# @return [Boolean] true if this queue was declared as server named.
|
65
|
-
# @see http://
|
65
|
+
# @see http://rubymarchhare.info/articles/queues.html Queues and Consumers guide
|
66
66
|
def server_named?
|
67
67
|
@server_named
|
68
68
|
end # server_named?
|
@@ -82,8 +82,8 @@ module MarchHare
|
|
82
82
|
# @option options [String] :routing_key Routing key
|
83
83
|
# @option options [Hash] :arguments ({}) Additional optional binding arguments
|
84
84
|
#
|
85
|
-
# @see http://
|
86
|
-
# @see http://
|
85
|
+
# @see http://rubymarchhare.info/articles/queues.html Queues and Consumers guide
|
86
|
+
# @see http://rubymarchhare.info/articles/bindings.html Bindings guide
|
87
87
|
def bind(exchange, options={})
|
88
88
|
exchange_name = if exchange.respond_to?(:name) then
|
89
89
|
exchange.name
|
@@ -108,8 +108,8 @@ module MarchHare
|
|
108
108
|
# @option options [String] :routing_key Routing key
|
109
109
|
# @option options [Hash] :arguments ({}) Additional optional binding arguments
|
110
110
|
#
|
111
|
-
# @see http://
|
112
|
-
# @see http://
|
111
|
+
# @see http://rubymarchhare.info/articles/queues.html Queues and Consumers guide
|
112
|
+
# @see http://rubymarchhare.info/articles/bindings.html Bindings guide
|
113
113
|
def unbind(exchange, options={})
|
114
114
|
exchange_name = if exchange.respond_to?(:name) then
|
115
115
|
exchange.name
|
@@ -129,13 +129,13 @@ module MarchHare
|
|
129
129
|
# @option [Boolean] if_unused (false) Should this queue be deleted only if it has no consumers?
|
130
130
|
# @option [Boolean] if_empty (false) Should this queue be deleted only if it has no messages?
|
131
131
|
#
|
132
|
-
# @see http://
|
132
|
+
# @see http://rubymarchhare.info/articles/queues.html Queues and Consumers guide
|
133
133
|
def delete(if_unused = false, if_empty = false)
|
134
134
|
@channel.queue_delete(@name, if_unused, if_empty)
|
135
135
|
end
|
136
136
|
|
137
137
|
# Purges a queue (removes all messages from it)
|
138
|
-
# @see http://
|
138
|
+
# @see http://rubymarchhare.info/articles/queues.html Queues and Consumers guide
|
139
139
|
# @api public
|
140
140
|
def purge
|
141
141
|
@channel.queue_purge(@name)
|
@@ -171,7 +171,7 @@ module MarchHare
|
|
171
171
|
# @option opts [String] :consumer_tag Unique consumer identifier. It is usually recommended to let MarchHare generate it for you.
|
172
172
|
# @option opts [Hash] :arguments ({}) Additional (optional) arguments, typically used by RabbitMQ extensions
|
173
173
|
#
|
174
|
-
# @see http://
|
174
|
+
# @see http://rubymarchhare.info/articles/queues.html Queues and Consumers guide
|
175
175
|
# @api public
|
176
176
|
def subscribe(opts = {}, &block)
|
177
177
|
subscribe_with(build_consumer(opts, &block), opts)
|
data/lib/march_hare/session.rb
CHANGED
@@ -14,8 +14,8 @@ module MarchHare
|
|
14
14
|
# @see .connect
|
15
15
|
# @see #create_channel
|
16
16
|
# @see #close
|
17
|
-
# @see http://
|
18
|
-
# @see http://
|
17
|
+
# @see http://rubymarchhare.info/articles/getting_started.html Getting Started guide
|
18
|
+
# @see http://rubymarchhare.info/articles/connecting.html Connecting to RabbitMQ guide
|
19
19
|
class Session
|
20
20
|
|
21
21
|
#
|
@@ -37,7 +37,7 @@ module MarchHare
|
|
37
37
|
# @option options [Integer] :heartbeat (600) Heartbeat interval. 0 means no heartbeat.
|
38
38
|
# @option options [Boolean] :tls (false) Set to true to use TLS/SSL connection. This will switch port to 5671 by default.
|
39
39
|
#
|
40
|
-
# @see http://
|
40
|
+
# @see http://rubymarchhare.info/articles/connecting.html Connecting to RabbitMQ guide
|
41
41
|
def self.connect(options={})
|
42
42
|
cf = ConnectionFactory.new
|
43
43
|
|
@@ -102,7 +102,7 @@ module MarchHare
|
|
102
102
|
#
|
103
103
|
# @return [MarchHare::Channel] Newly created channel
|
104
104
|
# @see MarchHare::Channel
|
105
|
-
# @see http://
|
105
|
+
# @see http://rubymarchhare.info/articles/getting_started.html Getting Started guide
|
106
106
|
def create_channel(n = nil)
|
107
107
|
jc = if n
|
108
108
|
@connection.create_channel(n)
|
@@ -350,7 +350,7 @@ module MarchHare
|
|
350
350
|
# @private
|
351
351
|
def build_executor_factory_from(opts)
|
352
352
|
# if we are given a thread pool size, construct
|
353
|
-
# a callable that
|
353
|
+
# a callable that creates a fixed size executor
|
354
354
|
# of that size. MK.
|
355
355
|
if n = opts[:thread_pool_size]
|
356
356
|
return Proc.new { MarchHare::ThreadPools.fixed_of_size(n) }
|
data/lib/march_hare/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: march_hare
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.0.
|
4
|
+
version: 2.0.0.rc4
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Theo Hultberg
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-10-
|
12
|
+
date: 2013-10-25 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: RabbitMQ client for JRuby built around the official RabbitMQ Java client
|
15
15
|
email:
|
@@ -61,4 +61,3 @@ signing_key:
|
|
61
61
|
specification_version: 4
|
62
62
|
summary: RabbitMQ client for JRuby built around the official RabbitMQ Java client
|
63
63
|
test_files: []
|
64
|
-
has_rdoc:
|