beetle_joevandyk_extensions 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -7,12 +7,13 @@ module BeetleJoevandykExtensions
7
7
 
8
8
  DEFAULT_TIMEOUT = 10
9
9
 
10
- AMQP_INFO_URI = URI.parse(ENV['AMQP_URL'])
11
-
12
- Beetle.config.servers = AMQP_INFO_URI.host
10
+ def client
11
+ uri = URI.parse(ENV['AMQP_URL'])
12
+ Beetle.config.servers = uri.host
13
+ Beetle::Client.new
14
+ end
13
15
 
14
16
  def rpc name, message, options={}
15
- client = Beetle::Client.new
16
17
  client.register_message name
17
18
  Timeout.timeout(options[:timeout] || DEFAULT_TIMEOUT, BeetleError) do
18
19
  status, result = client.rpc(name, message.to_json)
@@ -22,7 +23,6 @@ module BeetleJoevandykExtensions
22
23
  end
23
24
 
24
25
  def listen name, &block
25
- client = Beetle::Client.new
26
26
  client.register_queue name
27
27
  client.register_handler name do |input|
28
28
  block.call(JSON.parse(input.data)).to_json
@@ -33,7 +33,6 @@ module BeetleJoevandykExtensions
33
33
  end
34
34
 
35
35
  def publish name, message
36
- client = Beetle::Client.new
37
36
  client.register_message name
38
37
  client.publish name, message
39
38
  end
@@ -1,3 +1,3 @@
1
1
  module BeetleJoevandykExtensions
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beetle_joevandyk_extensions
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -14,7 +14,7 @@ default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: beetle
17
- requirement: &2156096460 !ruby/object:Gem::Requirement
17
+ requirement: &2156088880 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,7 +22,7 @@ dependencies:
22
22
  version: '0'
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *2156096460
25
+ version_requirements: *2156088880
26
26
  description: Extensions to Beetle
27
27
  email:
28
28
  - joe@fixieconsulting.com