rabbit-wq 2.0.0 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e8146dc0247a3db1e510b8c6205e8ede3892667a
4
- data.tar.gz: f141d450c09d9b0a925ce0f398f45aadfd1430f5
3
+ metadata.gz: 7eda05e56f6f09a461248b06fe4bbe469b47dd90
4
+ data.tar.gz: 3c0ee3b6a1e34c86af956ca37f81a8818e213e6a
5
5
  SHA512:
6
- metadata.gz: 7f62f6087f74838fb3b4b3f02a63c1e36663a714f192731203dafabc6f86c506d488fd43f14c270f1893094da87462aed35202592c07ca63d46708d3b80fde6d
7
- data.tar.gz: 76bdc1c54aba7299d5b7ba993b5fe5782bd508e8e7450a915f226c3c91938a20974596b55ec5d3a0ce4390426b89161985c7318644964e1b1f0c7056b0efbad6
6
+ metadata.gz: 4d33b58e75749d71fce83a5d6207855c9eb2bd1fb36f1173c7cd33a677221575c801a9cfa421caa10330cf40e3f49008f33b1763a429824a1b46fe62a33bdb01
7
+ data.tar.gz: 535e7ae18704a338b64a80a3d5635b5251e9a655edf83e6747cfefd33ec2fd8ce7cafa8daff587e89b01af32c4ed70a44ddff2fec56f6f9763b6d391f735bc75
data/README.md CHANGED
@@ -213,6 +213,14 @@ Here is an example configuration file with each option's default value:
213
213
  "work_log_path": "/var/log/rabbit-wq/rabbit-wq-work.log",
214
214
  "work_publish_queue": "work"
215
215
  "work_subscribe_queue": "work"
216
+ "ignored_workers": {
217
+ "to_error_queue": [
218
+ "Some::Worker"
219
+ ],
220
+ "trash": [
221
+ "Some::OtherWorker"
222
+ ]
223
+ }
216
224
  }
217
225
 
218
226
  #### Options
@@ -232,6 +240,12 @@ The environment to run in. Defaults to production.
232
240
  #####error_queue
233
241
  The name of the error queue. Defaults to error.
234
242
 
243
+ #####ignored_workers/to_error_queue
244
+ List of workers to ignore. Will add directly to error_queue without obeying retires, etc.
245
+
246
+ #####ignored_workers/trash
247
+ List of workers to ignore. Trashes the worker without error or complaining.
248
+
235
249
  #####threads
236
250
  The size of the thread pool. Can be overridden with the command line option --threads or -t. Defaults to 1.
237
251
 
@@ -24,5 +24,15 @@ module RabbitWQ
24
24
  }
25
25
  end
26
26
 
27
+ def ignored_workers_to_error_queue
28
+ return [] unless ignored_workers
29
+ Array( ignored_workers.to_error_queue )
30
+ end
31
+
32
+ def ignored_workers_trash
33
+ return [] unless ignored_workers
34
+ Array( ignored_workers.trash )
35
+ end
36
+
27
37
  end
28
38
  end
@@ -44,11 +44,22 @@ module RabbitWQ
44
44
  end
45
45
 
46
46
  def handle_work( worker, payload )
47
+ if ignore_and_trash?( worker )
48
+ info "Trashed: #{worker.class.name}:#{worker.object_id}"
49
+ return
50
+ end
51
+
52
+ if ignore_and_error?( worker )
53
+ info "Ignored and sent to error queue: #{worker.class.name}:#{worker.object_id}"
54
+ Work.enqueue_error_payload( payload, error: "Worker ignored" )
55
+ return
56
+ end
57
+
47
58
  unless worker.enabled?
59
+ worker_info( worker, "Worker disabled" )
48
60
  if worker.error_on_disabled?
49
61
  Work.enqueue_error_payload( payload, error: "Worker disabled" )
50
62
  end
51
- worker_info( worker, "Worker disabled" )
52
63
  return
53
64
  end
54
65
 
@@ -124,6 +135,18 @@ module RabbitWQ
124
135
  channel.reject delivery_info.delivery_tag, REQUEUE
125
136
  end
126
137
 
138
+ def ignore_and_trash?( worker )
139
+ config.ignored_workers_trash.include?( worker.class.name )
140
+ end
141
+
142
+ def ignore_and_error?( worker )
143
+ config.ignored_workers_to_error_queue.include?( worker.class.name )
144
+ end
145
+
146
+ def config
147
+ Servitude.configuration
148
+ end
149
+
127
150
  def retry_delays( retry_num )
128
151
  {
129
152
  1 => 1,
@@ -1,3 +1,3 @@
1
1
  module RabbitWQ
2
- VERSION = "2.0.0"
2
+ VERSION = "2.1.0"
3
3
  end
@@ -0,0 +1,23 @@
1
+ {
2
+ "delayed_exchange_prefix": "work-delay",
3
+ "delayed_queue_prefix": "work-delay",
4
+ "environment_file_path": "/some/path/to/environment/file"",
5
+ "env": "development",
6
+ "error_queue": "error",
7
+ "threads": 1,
8
+ "time_zone": "UTC",
9
+ "work_exchange": "work",
10
+ "work_exchange_type": "fanout",
11
+ "work_log_level": "debug",
12
+ "work_log_path": "/var/log/ncite/work.log",
13
+ "work_publish_queue": "work",
14
+ "work_subscribe_queue": "work-repo",
15
+ "ignored_workers": {
16
+ "to_error_queue": [
17
+ "Some::Worker"
18
+ ],
19
+ "trash": [
20
+ "Some::OtherWorker"
21
+ ]
22
+ }
23
+ }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rabbit-wq
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - C. Jason Harrelson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-24 00:00:00.000000000 Z
11
+ date: 2015-01-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -145,6 +145,7 @@ files:
145
145
  - lib/rabbit_wq/work_logger.rb
146
146
  - lib/rabbit_wq/work_logging.rb
147
147
  - lib/rabbit_wq/worker.rb
148
+ - rabbit-wq.conf.example
148
149
  - rabbit-wq.gemspec
149
150
  homepage: ''
150
151
  licenses: