beetle_joevandyk_extensions 0.0.9 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -7,13 +7,14 @@ module BeetleJoevandykExtensions
7
7
 
8
8
  DEFAULT_TIMEOUT = 10
9
9
 
10
- def client
10
+ def setup
11
11
  uri = URI.parse(ENV['AMQP_URL'])
12
12
  Beetle.config.servers = uri.host
13
- Beetle::Client.new
14
13
  end
15
14
 
16
15
  def rpc name, message, options={}
16
+ setup
17
+ client = Beetle::Client.new
17
18
  client.register_message name
18
19
  Timeout.timeout(options[:timeout] || DEFAULT_TIMEOUT, BeetleError) do
19
20
  status, result = client.rpc(name, message.to_json)
@@ -23,6 +24,8 @@ module BeetleJoevandykExtensions
23
24
  end
24
25
 
25
26
  def listen name, &block
27
+ setup
28
+ client = Beetle::Client.new
26
29
  client.register_queue name
27
30
  client.register_handler name do |input|
28
31
  block.call(JSON.parse(input.data)).to_json
@@ -33,6 +36,8 @@ module BeetleJoevandykExtensions
33
36
  end
34
37
 
35
38
  def publish name, message
39
+ setup
40
+ client = Beetle::Client.new
36
41
  client.register_message name
37
42
  client.publish name, message
38
43
  end
@@ -1,3 +1,3 @@
1
1
  module BeetleJoevandykExtensions
2
- VERSION = "0.0.9"
2
+ VERSION = "0.0.10"
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.9
4
+ version: 0.0.10
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: &2156088880 !ruby/object:Gem::Requirement
17
+ requirement: &2156081280 !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: *2156088880
25
+ version_requirements: *2156081280
26
26
  description: Extensions to Beetle
27
27
  email:
28
28
  - joe@fixieconsulting.com