insque 0.5.1 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: db352d3e0afe2bfd0243f0e9cd15a905226ae4fe
4
- data.tar.gz: 9ea0abcc665e264a0c51d1be4a20a9ba3e8d1ce7
3
+ metadata.gz: 01104bacbddad2fd85675e9f242aea346d3101c9
4
+ data.tar.gz: a3debfd746d82c059abf4f6423f1aa9bb2f6baf4
5
5
  SHA512:
6
- metadata.gz: cf57b0954f22ce0f5628df247942a732af6b4e61fab2b85667651107408091703f7ec733eaed175cd9f54911ca665a5c6d9dffebb55c06beb7c0de9a6c129970
7
- data.tar.gz: 2c2d5ae8ba1839d06b2f50519754c38ec2476178a88805570b099f32c63c95edcd4d3e91be05c30e4ed183edd862052b1b64cc8593281021419372b7dcd53663
6
+ metadata.gz: 8d2e64b82459b0268286ec5c9d2e9dd5209f58e99dbd8ac70f0bb734886e7f607b6cd0c4a2e3e40efd79552629e2791193fda349432f26c9cd0267f72b418a1c
7
+ data.tar.gz: 4240f9fb0a74cae2a5bf7b416b8ecc506d8fad44bf83562af008ecbc97d1c51bb505c4436dbf882c02f9edfc8cd31d3e9de5cc8ed42be999c3ca3d7ed0642246
data/README.md CHANGED
@@ -41,29 +41,66 @@ There is an easy way to use insque as background jobs processing. You can use `s
41
41
  To start recieving messages you need to:
42
42
 
43
43
  1. Create handler method in Insque module. First part of handler name is the name of the message sender.
44
- ```ruby
45
- def somesender_message_name message
46
- #TODO: Handle message somehow
47
- end
48
- ```
44
+ ```ruby
45
+ def somesender_message_name message
46
+ #TODO: Handle message somehow
47
+ end
48
+ ```
49
49
 
50
50
  2. Call `listen` method in some background process or rake task:
51
- ```ruby
52
- Insque.listen
53
- ```
51
+ ```ruby
52
+ Insque.listen
53
+ ```
54
54
 
55
55
  or just run `bundle exec rake insque:listener` from your console.
56
56
 
57
57
  3. Call `janitor` method in some background process or rake task. Janitor will reissue failed messages or report error if message fails again. Janitor treats message as failed if it was not processed for an hour after broadcast or reissue.
58
+ ```ruby
59
+ Insque.janitor
60
+ ```
61
+
62
+ or just run `bundle exec rake insque:janitor` from your console.
63
+
64
+ ### Slow Queue and send_later
65
+
66
+ Insque can be used for processing slow tasks in background. Slow tasks created with send_later method call of any ActiveRecord model:
58
67
  ```ruby
59
- Insque.janitor
68
+ User.send_later :some_slow_method
60
69
  ```
70
+ and processed by a special slow listener:
71
+ ```ruby
72
+ Insque.slow_listen
73
+ ```
74
+ there is matching slow janitor as well:
75
+ ```ruby
76
+ Insque.slow_janitor
77
+ ```
78
+ ### insque:run
61
79
 
62
- or just run `bundle exec rake insque:janitor` from your console.
80
+ There is a simple way to run all insque workers, both regular and slow in a single multi-threaded process:
81
+ ```ruby
82
+ bundle exec rake insque:run
83
+ ```
84
+
85
+ ### RedisCluster support
86
+
87
+ To make insque run on Redis Cluster add this line to your application's `Gemfile`:
88
+
89
+ gem 'redis_cluster'
90
+
91
+ and change `redis.yml` file accordingly:
92
+
93
+ production:
94
+ - host: cluster_host1
95
+ port: 1234
96
+ - host: cluster_host2
97
+ port: 1234
98
+ - host: cluster_host3
99
+ port: 1234
63
100
 
64
101
  ### Daemonizing
65
102
 
66
- If you want to run insque listener as a daemon consider using [foreman](https://github.com/ddollar/foreman) for this.
103
+ If you want to run insque as a daemon consider using [foreman](https://github.com/ddollar/foreman) for this.
67
104
 
68
105
  If you deploy with capistrano you may want to try a version of foreman with build in capistrano support.
69
106
 
@@ -78,8 +115,8 @@ Install it:
78
115
 
79
116
  Create `Procfile`:
80
117
 
81
- listener: bundle exec rake insque:listener
82
- janitor: bundle exec rake insque:janitor
118
+ insque: bundle exec rake insque:run
119
+
83
120
 
84
121
  Run foreman from your console:
85
122
 
@@ -88,7 +125,7 @@ Run foreman from your console:
88
125
  For production use modify your capistrano deploy script somewhat like this:
89
126
 
90
127
  set :default_environment, {'PATH' => "/sbin:$PATH"} # Optional. Useful if you get errors because start or restart command not found
91
- set :foreman_concurrency, "\"listener=2,janitor=1\"" # How many processes of each type do you want
128
+ set :foreman_concurrency, "\"insque=1\"" # How many processes of each type do you want
92
129
  require 'foreman/capistrano'
93
130
 
94
131
  after "deploy", "foreman:export" # Export Procfile as a set of upstart jobs
@@ -1,4 +1,4 @@
1
1
  Insque.sender = '<%= sender_name %>'
2
2
  REDIS_CONFIG = YAML.load(File.open("#{Rails.root}/config/redis.yml"))[Rails.env]
3
- Insque.redis_config = { :host => REDIS_CONFIG["host"], :port => REDIS_CONFIG["port"] }
3
+ Insque.redis_config = REDIS_CONFIG
4
4
  Insque.debug = true
@@ -1,3 +1,3 @@
1
1
  module Insque
2
- VERSION = "0.5.1"
2
+ VERSION = "0.5.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: insque
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - gropher