triggered_job 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +21 -0
  3. data/README.md +50 -0
  4. metadata +87 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 06090aceac8ddf14aa47eedc5ce765784bfb1a05
4
+ data.tar.gz: 6edc2977e3a093fba700a4c8389e1525a7a6629f
5
+ SHA512:
6
+ metadata.gz: aba73525fbfba8cee97cf9feab3557ba063ceaf898585616fc5757441bf15d28096f29346fc34bf47756cfb60a5bf46808cca9f94f185f4615a0f4b548320168
7
+ data.tar.gz: a78e546fcf8327dc9d361e0a182864e549856f00d20cd853c85a9e9be75a69eee33198c3cb5f214a5fd63bbe469110cb34700a90fcca402ec1119a6d7fed59fa
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2016
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,50 @@
1
+ # Triggered Job
2
+
3
+ Simple framework for trigger-based jobs
4
+
5
+ ## Installation
6
+
7
+ `gem 'triggered_job'`
8
+
9
+ ## Usage
10
+
11
+ Create a base job and mix in your async worker library of choice
12
+
13
+ ### Sidekiq
14
+
15
+ ```
16
+ class BaseJob < TriggeredJob::Base
17
+ include Sidekiq::Worker
18
+ end
19
+
20
+ class MyTriggeredJob < BaseJob
21
+ triggered_by "my_trigger"
22
+
23
+ def perform(id, args*)
24
+ # ...
25
+ end
26
+ end
27
+ ```
28
+
29
+ Create a subscription process
30
+
31
+ ### Eventmachine Redis example
32
+
33
+ ```
34
+ require 'em-hiredis'
35
+ require 'json'
36
+
37
+ EM.run {
38
+ redis = EM::Hiredis.connect
39
+ redis.pubsub.psubscribe('MY_PREFIX.*') do |channel, data|
40
+ trigger = channel.gsub(/MY_PREFIX\./, '')
41
+ id = (JSON.parse(data))["id"]
42
+
43
+ jobs = TriggeredJob.triggered_by(trigger)
44
+ unless jobs.nil?
45
+ jobs.each { |job| job.constantize.perform_async(id) }
46
+ end
47
+ end
48
+ }
49
+ ```
50
+
metadata ADDED
@@ -0,0 +1,87 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: triggered_job
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Daniel Hanson
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-10-18 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rspec
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '3.5'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '3.5'
27
+ - !ruby/object:Gem::Dependency
28
+ name: simplecov
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '0.12'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '0.12'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '11.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '11.0'
55
+ description: Simple framework for trigger-based jobs
56
+ email: hansondr@gmail.com
57
+ executables: []
58
+ extensions: []
59
+ extra_rdoc_files: []
60
+ files:
61
+ - LICENSE
62
+ - README.md
63
+ homepage: https://github.com/hansondr/triggered_job
64
+ licenses:
65
+ - MIT
66
+ metadata: {}
67
+ post_install_message:
68
+ rdoc_options: []
69
+ require_paths:
70
+ - lib
71
+ required_ruby_version: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ required_rubygems_version: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ version: '0'
81
+ requirements: []
82
+ rubyforge_project:
83
+ rubygems_version: 2.5.1
84
+ signing_key:
85
+ specification_version: 4
86
+ summary: Simple framework for trigger-based jobs
87
+ test_files: []