activemessaging-kestrel-adapter 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,7 @@
1
+ == 1.0.2 / 2012-02-10
2
+ * Scrub queue names of illegal characters (according to kestrel v2.1.5). The illegal
3
+ chars are '.', '/', '~'.
4
+
1
5
  == 1.0.1 / 2012-01-18
2
6
  * Call load_extensions on ActiveMessaging before registering the adapter. Avoids
3
7
  unresolved references to ActiveMessaging::Gateway.
@@ -6,6 +6,11 @@ module ActiveMessaging
6
6
  # This module contains code to integrate the ActiveMessaging framework with a
7
7
  # kestrel message queue server.
8
8
  module Kestrel
9
+ QUEUE_NAME_NORMALIZATIONS = {
10
+ '/' => '__4S__',
11
+ '.' => '__D0T__',
12
+ '~' => '__T1L__'
13
+ }
9
14
  # Simple struct for wrapping received messages
10
15
  Message = Struct.new(:headers, :body, :destination) do
11
16
  def matches_subscription?(subscription)
@@ -105,7 +110,7 @@ module ActiveMessaging
105
110
  queues.each do |queue|
106
111
  KESTREL_STATS_QUEUE_KEYS.each do |key|
107
112
  stats_key = "queue_#{queue}_#{key}"
108
- denormalized_name = queue.gsub('--FS--', '/') # denormalize the name ...
113
+ denormalized_name = queue.gsub('FS', '/') # denormalize the name ...
109
114
  return_hash[server_def][denormalized_name][key] = stats_hash[stats_key]
110
115
  end
111
116
  end
@@ -186,10 +191,27 @@ module ActiveMessaging
186
191
  logger
187
192
  end
188
193
 
194
+ def denormalize(name)
195
+ @denormalized_names ||= Hash.new do |h,k|
196
+ newkey = k
197
+ QUEUE_NAME_NORMALIZATIONS.each do |bad, good|
198
+ newkey = newkey.gsub(good, bad)
199
+ end
200
+ h[k] = newkey
201
+ end
202
+ @denormalized_names[name]
203
+ end
204
+
189
205
  def normalize(name)
190
- # Kestrel doesn't like '/' chars in queue names, so get rid of them
206
+ # Kestrel doesn't like certain chars in queue names, so get rid of them
191
207
  # (and memoize the calculation)
192
- @normalized_names ||= Hash.new {|h,k| h[k] = k.gsub('/', '--FS--')}
208
+ @normalized_names ||= Hash.new do |h,k|
209
+ newkey = k
210
+ QUEUE_NAME_NORMALIZATIONS.each do |bad, good|
211
+ newkey = newkey.gsub(bad, good)
212
+ end
213
+ h[k] = newkey
214
+ end
193
215
  @normalized_names[name]
194
216
  end
195
217
 
data/version.txt CHANGED
@@ -1 +1 @@
1
- 1.0.1
1
+ 1.0.2
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activemessaging-kestrel-adapter
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,12 +9,12 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-01-18 00:00:00.000000000 -08:00
12
+ date: 2012-02-10 00:00:00.000000000 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: memcache-client
17
- requirement: &70199722819920 !ruby/object:Gem::Requirement
17
+ requirement: &70195407021820 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: 1.8.5
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *70199722819920
25
+ version_requirements: *70195407021820
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: activemessaging
28
- requirement: &70199722817820 !ruby/object:Gem::Requirement
28
+ requirement: &70195407020720 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ! '>='
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: 0.7.1
34
34
  type: :runtime
35
35
  prerelease: false
36
- version_requirements: *70199722817820
36
+ version_requirements: *70195407020720
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: activesupport
39
- requirement: &70199722814520 !ruby/object:Gem::Requirement
39
+ requirement: &70195407019240 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ! '>='
@@ -44,10 +44,10 @@ dependencies:
44
44
  version: 3.1.3
45
45
  type: :runtime
46
46
  prerelease: false
47
- version_requirements: *70199722814520
47
+ version_requirements: *70195407019240
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: i18n
50
- requirement: &70199722813080 !ruby/object:Gem::Requirement
50
+ requirement: &70195407018060 !ruby/object:Gem::Requirement
51
51
  none: false
52
52
  requirements:
53
53
  - - ! '>='
@@ -55,10 +55,10 @@ dependencies:
55
55
  version: 0.6.0
56
56
  type: :runtime
57
57
  prerelease: false
58
- version_requirements: *70199722813080
58
+ version_requirements: *70195407018060
59
59
  - !ruby/object:Gem::Dependency
60
60
  name: bones
61
- requirement: &70199722811940 !ruby/object:Gem::Requirement
61
+ requirement: &70195407016720 !ruby/object:Gem::Requirement
62
62
  none: false
63
63
  requirements:
64
64
  - - ! '>='
@@ -66,7 +66,7 @@ dependencies:
66
66
  version: 3.7.3
67
67
  type: :development
68
68
  prerelease: false
69
- version_requirements: *70199722811940
69
+ version_requirements: *70195407016720
70
70
  description: ! "This is an adapter to the kestrel messaging server for the ActiveMessaging
71
71
  framework. It is \nin the early stages of development."
72
72
  email: doug@dseifert.net