right_amqp 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -111,7 +111,8 @@ module RightAMQP
111
111
  @host = address[:host]
112
112
  @port = address[:port].to_i
113
113
  @index = address[:index].to_i
114
- @alias = "b#{@index}"
114
+ set_alias(@index)
115
+
115
116
  unless serializer.nil? || [:dump, :load].all? { |m| serializer.respond_to?(m) }
116
117
  raise ArgumentError, "serializer must be a class/object that responds to :dump and :load"
117
118
  end
@@ -134,6 +135,17 @@ module RightAMQP
134
135
  end
135
136
  end
136
137
 
138
+ # Set alias for broker for use in logs
139
+ #
140
+ # === Parameters
141
+ # index(Integer):: Unique index for broker within given set
142
+ #
143
+ # === Return
144
+ # (String):: Broker alias
145
+ def set_alias(index)
146
+ @alias = "b#{index}"
147
+ end
148
+
137
149
  # Determine whether the broker connection is usable, i.e., connecting or confirmed connected
138
150
  #
139
151
  # === Return
@@ -258,7 +258,8 @@ module RightAMQP
258
258
  #
259
259
  # === Returns
260
260
  # (String):: Broker serialized identity
261
- def self.identity(host, port = ::AMQP::PORT)
261
+ def self.identity(host, port = nil)
262
+ port ||= ::AMQP::PORT
262
263
  "rs-broker-#{host.gsub('-', '~')}-#{port.to_i}"
263
264
  end
264
265
 
data/right_amqp.gemspec CHANGED
@@ -24,7 +24,8 @@ require 'rubygems'
24
24
 
25
25
  Gem::Specification.new do |spec|
26
26
  spec.name = 'right_amqp'
27
- spec.version = '0.2.0'
27
+ spec.version = '0.2.1'
28
+ spec.date = '2012-03-20'
28
29
  spec.authors = ['Lee Kirchhoff']
29
30
  spec.email = 'lee@rightscale.com'
30
31
  spec.homepage = 'https://github.com/rightscale/right_amqp'
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: right_amqp
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 0
10
- version: 0.2.0
9
+ - 1
10
+ version: 0.2.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Lee Kirchhoff
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-03-12 00:00:00 -07:00
18
+ date: 2012-03-20 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency