amqp-utils 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/amqp-utils.gemspec +2 -2
- data/bin/amqp-deleteq +1 -1
- data/bin/amqp-enqueue +13 -4
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.2
|
data/amqp-utils.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{amqp-utils}
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Doug Barth"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-09-28}
|
13
13
|
s.description = %q{Command line utilies for interacting with AMQP compliant queues.
|
14
14
|
The intention is provide simple management tools that can be used to complete ad hoc
|
15
15
|
housework on an AMQP queue. In addition, simple scripts can be layered over the tools
|
data/bin/amqp-deleteq
CHANGED
data/bin/amqp-enqueue
CHANGED
@@ -8,29 +8,38 @@ class EnqueueCommand < AmqpUtils::Command
|
|
8
8
|
options.banner %Q{
|
9
9
|
|Publishes a message to a particular queue.
|
10
10
|
|
|
11
|
-
| #{command_name} <queue>
|
11
|
+
| #{command_name} <queue>
|
12
12
|
|
|
13
13
|
|Enqueue options:
|
14
14
|
}.margin
|
15
15
|
options.opt :persistent, 'Mark messages as persistent.', :short => :none
|
16
|
+
options.opt :priority, 'The priority of this message', :type => :int, :short => :none, :default => 1
|
16
17
|
options.opt :count, 'Number of times the message should be published.', :type => :int, :default => 1
|
18
|
+
options.opt :header, 'A key-value pair to be set in "headers" field of the AMQP header', :short => :none, :type => :string, :multi => true
|
19
|
+
options.opt :message, 'The message to publish to the queue. Comes from STDIN if not provided.', :type => :string, :default => nil
|
17
20
|
end
|
18
21
|
|
19
22
|
def validate
|
23
|
+
if options[:header]
|
24
|
+
options[:header] = Hash[*(options[:header].map do |h|
|
25
|
+
h.split('=')
|
26
|
+
end.flatten)]
|
27
|
+
end
|
20
28
|
raise "need a queue to publish to" unless args[0] && !args[0].empty?
|
21
|
-
raise "need a message to publish" unless args[1] && !args[1].empty?
|
22
29
|
end
|
23
30
|
|
24
31
|
def execute
|
25
|
-
@queue
|
32
|
+
@queue = args
|
33
|
+
@message = options[:message] || STDIN.read
|
26
34
|
|
27
35
|
publisher = EM.spawn do |queue, message, messages, options|
|
28
36
|
@progress ||= Clio::Progressbar.new('Enqueuing', options[:count])
|
29
37
|
|
30
38
|
if messages > 0
|
31
39
|
@mq ||= MQ.new
|
40
|
+
headers = options[:header]
|
32
41
|
@mq.queue(queue, :durable => true, :auto_delete => false).
|
33
|
-
publish(message, :persistent => options.persistent)
|
42
|
+
publish(message, :persistent => options.persistent, :headers => headers, :priority => options.priority)
|
34
43
|
|
35
44
|
@progress.inc
|
36
45
|
publisher.notify(queue, message, messages - 1, options)
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 2
|
8
|
-
-
|
9
|
-
version: 0.2.
|
8
|
+
- 2
|
9
|
+
version: 0.2.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Doug Barth
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-
|
17
|
+
date: 2010-09-28 00:00:00 -05:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|