amqp-utils 0.2.3 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/VERSION +1 -1
  2. data/amqp-utils.gemspec +6 -5
  3. data/bin/amqp-spy +40 -0
  4. metadata +21 -4
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.3
1
+ 0.3.0
data/amqp-utils.gemspec CHANGED
@@ -5,17 +5,17 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{amqp-utils}
8
- s.version = "0.2.3"
8
+ s.version = "0.3.0"
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-09-30}
12
+ s.date = %q{2011-02-02}
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
16
16
  when needed.}
17
17
  s.email = %q{dougbarth@gmail.com}
18
- s.executables = ["amqp-deleteq", "amqp-dequeue", "amqp-enqueue", "amqp-peek", "amqp-pop", "amqp-purge", "amqp-statq"]
18
+ s.executables = ["amqp-deleteq", "amqp-dequeue", "amqp-enqueue", "amqp-peek", "amqp-pop", "amqp-purge", "amqp-spy", "amqp-statq"]
19
19
  s.extra_rdoc_files = [
20
20
  "README.txt"
21
21
  ]
@@ -34,6 +34,7 @@ Gem::Specification.new do |s|
34
34
  "bin/amqp-peek",
35
35
  "bin/amqp-pop",
36
36
  "bin/amqp-purge",
37
+ "bin/amqp-spy",
37
38
  "bin/amqp-statq",
38
39
  "lib/amqp_utils.rb",
39
40
  "lib/amqp_utils/command.rb",
@@ -45,7 +46,7 @@ Gem::Specification.new do |s|
45
46
  s.rdoc_options = ["--charset=UTF-8"]
46
47
  s.require_paths = ["lib"]
47
48
  s.rubyforge_project = %q{amqp-utils}
48
- s.rubygems_version = %q{1.3.6}
49
+ s.rubygems_version = %q{1.3.7}
49
50
  s.summary = %q{Command line utilities for interacting with AMQP compliant queues}
50
51
  s.test_files = [
51
52
  "test/test_amqp_utils.rb",
@@ -56,7 +57,7 @@ Gem::Specification.new do |s|
56
57
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
57
58
  s.specification_version = 3
58
59
 
59
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
60
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
60
61
  s.add_runtime_dependency(%q<amqp>, ["~> 0.6.7"])
61
62
  s.add_runtime_dependency(%q<trollop>, ["~> 1.10.2"])
62
63
  s.add_runtime_dependency(%q<facets>, ["~> 2.7.0"])
data/bin/amqp-spy ADDED
@@ -0,0 +1,40 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require File.dirname(__FILE__) + '/../lib/amqp_utils/command'
4
+ require File.dirname(__FILE__) + '/../lib/amqp_utils/message_formatter'
5
+
6
+ class SpyCommand < AmqpUtils::Command
7
+ def prepare_options(options)
8
+ options.banner %Q{
9
+ |Spies on a specific exchange and routing key.
10
+ |
11
+ | #{command_name} <exchange> [<routing_key>]
12
+ |
13
+ |Spy options:
14
+ }.margin
15
+ options.opt :format, 'The format that the messages should be displayed as',
16
+ :short => :none, :default => 'pretty'
17
+ end
18
+
19
+ def validate
20
+ Trollop::die "needs an exchange name" unless args[0] && !args[0].empty?
21
+
22
+ @formatter = AmqpUtils::MessageFormatter.for_type(options[:format])
23
+ Trollop::die :format, "not an available type: #{AmqpUtils::MessageFormatter.types.join(", ")}" unless @formatter
24
+ end
25
+
26
+ def execute
27
+ @exchange_name = args[0]
28
+ @routing_key = args[1] || '*'
29
+ spy_queue = "amqp-spy.#{@routing_key}." + (0...6).map{ (('a'..'f').to_a + (0..9).to_a)[rand(16)] }.join
30
+
31
+ queue = mq.queue(spy_queue, :auto_delete => true)
32
+ queue.bind(@exchange_name, :routing_key => @routing_key)
33
+
34
+ queue.subscribe do |header, message|
35
+ @formatter.generate(STDOUT, header, message)
36
+ end
37
+ end
38
+ end
39
+
40
+ SpyCommand.run
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: amqp-utils
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 19
4
5
  prerelease: false
5
6
  segments:
6
7
  - 0
7
- - 2
8
8
  - 3
9
- version: 0.2.3
9
+ - 0
10
+ version: 0.3.0
10
11
  platform: ruby
11
12
  authors:
12
13
  - Doug Barth
@@ -14,16 +15,18 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-09-30 00:00:00 -05:00
18
+ date: 2011-02-02 00:00:00 -06:00
18
19
  default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
21
22
  name: amqp
22
23
  prerelease: false
23
24
  requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
24
26
  requirements:
25
27
  - - ~>
26
28
  - !ruby/object:Gem::Version
29
+ hash: 9
27
30
  segments:
28
31
  - 0
29
32
  - 6
@@ -35,9 +38,11 @@ dependencies:
35
38
  name: trollop
36
39
  prerelease: false
37
40
  requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
38
42
  requirements:
39
43
  - - ~>
40
44
  - !ruby/object:Gem::Version
45
+ hash: 59
41
46
  segments:
42
47
  - 1
43
48
  - 10
@@ -49,9 +54,11 @@ dependencies:
49
54
  name: facets
50
55
  prerelease: false
51
56
  requirement: &id003 !ruby/object:Gem::Requirement
57
+ none: false
52
58
  requirements:
53
59
  - - ~>
54
60
  - !ruby/object:Gem::Version
61
+ hash: 19
55
62
  segments:
56
63
  - 2
57
64
  - 7
@@ -63,9 +70,11 @@ dependencies:
63
70
  name: clio
64
71
  prerelease: false
65
72
  requirement: &id004 !ruby/object:Gem::Requirement
73
+ none: false
66
74
  requirements:
67
75
  - - ~>
68
76
  - !ruby/object:Gem::Version
77
+ hash: 19
69
78
  segments:
70
79
  - 0
71
80
  - 3
@@ -77,9 +86,11 @@ dependencies:
77
86
  name: json
78
87
  prerelease: false
79
88
  requirement: &id005 !ruby/object:Gem::Requirement
89
+ none: false
80
90
  requirements:
81
91
  - - ~>
82
92
  - !ruby/object:Gem::Version
93
+ hash: 31
83
94
  segments:
84
95
  - 1
85
96
  - 1
@@ -100,6 +111,7 @@ executables:
100
111
  - amqp-peek
101
112
  - amqp-pop
102
113
  - amqp-purge
114
+ - amqp-spy
103
115
  - amqp-statq
104
116
  extensions: []
105
117
 
@@ -120,6 +132,7 @@ files:
120
132
  - bin/amqp-peek
121
133
  - bin/amqp-pop
122
134
  - bin/amqp-purge
135
+ - bin/amqp-spy
123
136
  - bin/amqp-statq
124
137
  - lib/amqp_utils.rb
125
138
  - lib/amqp_utils/command.rb
@@ -136,23 +149,27 @@ rdoc_options:
136
149
  require_paths:
137
150
  - lib
138
151
  required_ruby_version: !ruby/object:Gem::Requirement
152
+ none: false
139
153
  requirements:
140
154
  - - ">="
141
155
  - !ruby/object:Gem::Version
156
+ hash: 3
142
157
  segments:
143
158
  - 0
144
159
  version: "0"
145
160
  required_rubygems_version: !ruby/object:Gem::Requirement
161
+ none: false
146
162
  requirements:
147
163
  - - ">="
148
164
  - !ruby/object:Gem::Version
165
+ hash: 3
149
166
  segments:
150
167
  - 0
151
168
  version: "0"
152
169
  requirements: []
153
170
 
154
171
  rubyforge_project: amqp-utils
155
- rubygems_version: 1.3.6
172
+ rubygems_version: 1.3.7
156
173
  signing_key:
157
174
  specification_version: 3
158
175
  summary: Command line utilities for interacting with AMQP compliant queues