background_bunnies 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,9 +1,9 @@
1
1
  require_relative 'increments'
2
2
  require 'thread'
3
3
  connection = Bunny.new
4
- connection.start
4
+ BackgroundBunnies::configure(:default, connection)
5
5
 
6
- producer = BackgroundBunnies::Workers::IncrementCounter.create_producer connection
6
+ producer = BackgroundBunnies::Workers::IncrementCounter.create_producer :default
7
7
  step = 0.1
8
8
  while true
9
9
  step += 0.1
@@ -5,11 +5,17 @@ module BackgroundBunnies
5
5
  attr_reader :channel
6
6
  attr_reader :queue
7
7
  attr_reader :queue_name
8
+ attr_reader :connection
8
9
 
9
10
  def initialize(connection, queue_name)
11
+ if connection.is_a? Symbol
12
+ @connection = BackgroundBunnies.connections[connection]
13
+ else
14
+ @connection = connection
15
+ end
10
16
  @queue_name = queue_name.to_s
11
- @channel = connection.create_channel
12
- @queue = connection.queue(@queue_name)
17
+ @channel = @connection.create_channel
18
+ @queue = @connection.queue(@queue_name)
13
19
  end
14
20
 
15
21
  #
@@ -1,3 +1,3 @@
1
1
  module BackgroundBunnies
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -17,6 +17,8 @@ module BackgroundBunnies
17
17
  @configs || @configs = {}
18
18
  end
19
19
 
20
+ alias connections configurations
21
+
20
22
  #
21
23
  # Configures the connection of a group
22
24
  #
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: background_bunnies
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-21 00:00:00.000000000 Z
12
+ date: 2013-04-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bunny