ayl-beanstalk 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -3,6 +3,68 @@
3
3
  This gem provides a reference implementation of a beanstalk Engine for the
4
4
  {ayl}[https://github.com/j0hnds/ayl] gem.
5
5
 
6
+ If you want to use this technology in a Rails 3.* application you can do the
7
+ following in your config/environments/*.rb files:
8
+
9
+ YourApp::Application.configure do
10
+
11
+ ...
12
+
13
+ config.after_initialize do
14
+ # Set up a delay for AYL so we make sure the object is
15
+ # saved before we pick it up off the queue. Defaults to 0
16
+ # Ayl::MessageOptions.default_delay = 2
17
+
18
+ # Set up a priority fo AYL. The lower the priority number
19
+ # the higher the priority. The default is 512.
20
+ # Ayl::MessageOptions.default_priority = 1
21
+
22
+ # Set up a time to run for AYL. This is the number of seconds
23
+ # that a worker has to complete the job before the queuing engine
24
+ # re-inserts the message into the queue. Defaults to 120 seconds
25
+ # Ayl::MessageOptions.default_time_to_run = 120
26
+
27
+ # Set up the name of the queue to use in the queuing engine for
28
+ # messages. Typically, you will use the application version for
29
+ # the name of the queue so that you won't have problems with items
30
+ # left in the queue when the version of the software changes.
31
+ # The default is 'default'.
32
+ # Ayl::MessageOptions.default_queue_name = '1.2.3'
33
+
34
+ # Set up the logger for Ayl
35
+ Ayl::Logger.instance.logger = ::Rails.logger
36
+
37
+ # Set up the beanstalk engine for use
38
+ Ayl::Engine.add_engine(Ayl::Beanstalk::Engine.new('localhost', 8903)
39
+ end
40
+
41
+ end
42
+
43
+ If beanstalkd is running at the time your application starts up, your async messages
44
+ will be sent to beanstalkd. If beanstalkd is NOT running, your messages will be
45
+ invoked synchronously (without errors).
46
+
47
+ Once you get your messages in beanstalkd, you will probably want them to get executed
48
+ (or what would be the point?). This gem provides a couple of scripts to assist in
49
+ starting up a worker process to read messages off the beanstalkd queue and process them.
50
+
51
+ * ayl_worker - This script runs in the foreground and processes messages off the beanstalkd queue.
52
+ * ayl_worker_control - This script runs the ayl_worker script as a daemon to process messages in the background.
53
+
54
+ For example, if you want to run the worker in the foreground you would invoke the following:
55
+
56
+ ayl_worker -a /var/www/application/current -r -e production -t default
57
+
58
+ If you want to have the script run in the background:
59
+
60
+ ayl_worker_control start -- -a /var/www/application/current -r -e production -t default -p /tmp
61
+
62
+ or to stop the background script:
63
+
64
+ ayl_worker_control stop -- -a /var/www/application/current -r -e production -t default -p /tmp
65
+
66
+ The ayl_worker_control script can easily be invoked by an /etc/init.d script to allow your workers to start at server boot time.
67
+
6
68
  == Contributing to ayl-beanstalk
7
69
 
8
70
  * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
@@ -0,0 +1,85 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = "ayl-beanstalk"
8
+ s.version = "0.1.1"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["j0hnds@gmail.com"]
12
+ s.date = "2011-11-26"
13
+ s.description = "Ayl extension to provide beanstalk support."
14
+ s.email = "j0hnds@gmail.com"
15
+ s.executables = ["ayl_beanstalk", "ayl_worker", "ayl_worker_control"]
16
+ s.extra_rdoc_files = [
17
+ "LICENSE.txt",
18
+ "README.rdoc"
19
+ ]
20
+ s.files = [
21
+ ".document",
22
+ ".rspec",
23
+ "Gemfile",
24
+ "Gemfile.lock",
25
+ "LICENSE.txt",
26
+ "README.rdoc",
27
+ "Rakefile",
28
+ "VERSION",
29
+ "ayl-beanstalk.gemspec",
30
+ "bin/ayl_beanstalk",
31
+ "bin/ayl_worker",
32
+ "bin/ayl_worker_control",
33
+ "lib/ayl-beanstalk.rb",
34
+ "lib/ayl-beanstalk/command_line.rb",
35
+ "lib/ayl-beanstalk/engine.rb",
36
+ "lib/ayl-beanstalk/pool.rb",
37
+ "lib/ayl-beanstalk/worker.rb",
38
+ "spec/ayl_worker_spec.rb",
39
+ "spec/command_line_spec.rb",
40
+ "spec/engine_spec.rb",
41
+ "spec/spec_helper.rb",
42
+ "spec/support/config/environment.rb",
43
+ "spec/support/exit_code_matchers.rb",
44
+ "spec/worker_spec.rb"
45
+ ]
46
+ s.homepage = "http://github.com/j0hnds/ayl-beanstalk"
47
+ s.licenses = ["MIT"]
48
+ s.require_paths = ["lib"]
49
+ s.rubygems_version = "1.8.10"
50
+ s.summary = "Ayl extension to provide beanstalk support."
51
+
52
+ if s.respond_to? :specification_version then
53
+ s.specification_version = 3
54
+
55
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
56
+ s.add_runtime_dependency(%q<ayl>, [">= 0.1.0"])
57
+ s.add_runtime_dependency(%q<beanstalk-client>, [">= 1.1.0"])
58
+ s.add_runtime_dependency(%q<daemons>, [">= 1.1.0"])
59
+ s.add_development_dependency(%q<rspec>, [">= 2.3.0"])
60
+ s.add_development_dependency(%q<bundler>, [">= 1.0.0"])
61
+ s.add_development_dependency(%q<jeweler>, [">= 1.6.4"])
62
+ s.add_development_dependency(%q<rcov>, [">= 0"])
63
+ s.add_development_dependency(%q<pry>, [">= 0"])
64
+ else
65
+ s.add_dependency(%q<ayl>, [">= 0.1.0"])
66
+ s.add_dependency(%q<beanstalk-client>, [">= 1.1.0"])
67
+ s.add_dependency(%q<daemons>, [">= 1.1.0"])
68
+ s.add_dependency(%q<rspec>, [">= 2.3.0"])
69
+ s.add_dependency(%q<bundler>, [">= 1.0.0"])
70
+ s.add_dependency(%q<jeweler>, [">= 1.6.4"])
71
+ s.add_dependency(%q<rcov>, [">= 0"])
72
+ s.add_dependency(%q<pry>, [">= 0"])
73
+ end
74
+ else
75
+ s.add_dependency(%q<ayl>, [">= 0.1.0"])
76
+ s.add_dependency(%q<beanstalk-client>, [">= 1.1.0"])
77
+ s.add_dependency(%q<daemons>, [">= 1.1.0"])
78
+ s.add_dependency(%q<rspec>, [">= 2.3.0"])
79
+ s.add_dependency(%q<bundler>, [">= 1.0.0"])
80
+ s.add_dependency(%q<jeweler>, [">= 1.6.4"])
81
+ s.add_dependency(%q<rcov>, [">= 0"])
82
+ s.add_dependency(%q<pry>, [">= 0"])
83
+ end
84
+ end
85
+
@@ -6,6 +6,8 @@ module Ayl
6
6
  include Ayl::Logging
7
7
  include Ayl::Beanstalk::Pool
8
8
 
9
+ attr_reader :host, :port
10
+
9
11
  def initialize(host='localhost', port=11300)
10
12
  logger.info "#{self.class.name}.initialize(#{host.inspect}, #{port})"
11
13
  @host = host
data/spec/engine_spec.rb CHANGED
@@ -14,6 +14,11 @@ describe Ayl::Beanstalk::Engine do
14
14
  @engine.stub_chain(:logger, :error)
15
15
  end
16
16
 
17
+ it "should default to localhost and 11300 as the host port for the beanstalkd server" do
18
+ @engine.host.should == 'localhost'
19
+ @engine.port.should == 11300
20
+ end
21
+
17
22
  it "should respond true to the asynchronous? message" do
18
23
  @engine.asynchronous?.should be_true
19
24
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ayl-beanstalk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-11-20 00:00:00.000000000Z
12
+ date: 2011-11-26 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ayl
16
- requirement: &87968020 !ruby/object:Gem::Requirement
16
+ requirement: &76745740 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 0.1.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *87968020
24
+ version_requirements: *76745740
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: beanstalk-client
27
- requirement: &87967750 !ruby/object:Gem::Requirement
27
+ requirement: &76745460 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 1.1.0
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *87967750
35
+ version_requirements: *76745460
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: daemons
38
- requirement: &87967500 !ruby/object:Gem::Requirement
38
+ requirement: &76745190 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 1.1.0
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *87967500
46
+ version_requirements: *76745190
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rspec
49
- requirement: &87967220 !ruby/object:Gem::Requirement
49
+ requirement: &76744930 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 2.3.0
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *87967220
57
+ version_requirements: *76744930
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: bundler
60
- requirement: &87966960 !ruby/object:Gem::Requirement
60
+ requirement: &76744580 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: 1.0.0
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *87966960
68
+ version_requirements: *76744580
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: jeweler
71
- requirement: &87966690 !ruby/object:Gem::Requirement
71
+ requirement: &76744270 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: 1.6.4
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *87966690
79
+ version_requirements: *76744270
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: rcov
82
- requirement: &87966350 !ruby/object:Gem::Requirement
82
+ requirement: &76743930 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: '0'
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *87966350
90
+ version_requirements: *76743930
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: pry
93
- requirement: &87966010 !ruby/object:Gem::Requirement
93
+ requirement: &76743560 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ! '>='
@@ -98,7 +98,7 @@ dependencies:
98
98
  version: '0'
99
99
  type: :development
100
100
  prerelease: false
101
- version_requirements: *87966010
101
+ version_requirements: *76743560
102
102
  description: Ayl extension to provide beanstalk support.
103
103
  email: j0hnds@gmail.com
104
104
  executables:
@@ -118,6 +118,7 @@ files:
118
118
  - README.rdoc
119
119
  - Rakefile
120
120
  - VERSION
121
+ - ayl-beanstalk.gemspec
121
122
  - bin/ayl_beanstalk
122
123
  - bin/ayl_worker
123
124
  - bin/ayl_worker_control
@@ -148,7 +149,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
148
149
  version: '0'
149
150
  segments:
150
151
  - 0
151
- hash: 349899887
152
+ hash: 36129679
152
153
  required_rubygems_version: !ruby/object:Gem::Requirement
153
154
  none: false
154
155
  requirements: