sidekiq-eventbus 0.0.2 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -0
- data/lib/sidekiq/event_bus/configuration.rb +2 -1
- data/lib/sidekiq/event_bus/consumer.rb +11 -11
- data/lib/sidekiq/event_bus/producer.rb +1 -1
- data/lib/sidekiq/event_bus/utils.rb +6 -0
- metadata +44 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6cee5a4ecfbeb86566ece98a9d419e008f3b1e82
|
4
|
+
data.tar.gz: eb2bbd145e485b05c195b81fa217f3ffd18a452c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 149ea8e9306733ca7777b4e7ace73bd670228e977e567061aeeb1f9d975834c6bc05132c38c0a3ead4e31b2be7acbc5dc2707a32846aa8dfb4d08b431028ca3e
|
7
|
+
data.tar.gz: 5136f83e2f4ec1c8f3ff416cf414f96bb60b7e15c6a64b480202e3e094eaa4f68d64f596d025ed94c9b15af8061b88681fb58346b0bc72a63cccd2868d3d84cb
|
data/README.md
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
class Sidekiq::EventBus::Configuration
|
2
|
-
attr_accessor :adapter, :consumers, :sidekiq_worker_options
|
2
|
+
attr_accessor :adapter, :consumers, :sidekiq_worker_options, :error_handler
|
3
|
+
|
3
4
|
def initialize
|
4
5
|
self.adapter = Sidekiq::EventBus::Adapters::Default.new
|
5
6
|
self.consumers = Hash.new { |hash, key| hash[key] = Set.new }
|
@@ -24,19 +24,19 @@ class Sidekiq::EventBus::Consumer
|
|
24
24
|
|
25
25
|
|
26
26
|
def consume topic, event, payload
|
27
|
-
|
27
|
+
if self.class.handlers.key? event
|
28
|
+
_payload = payload.merge('topic'.freeze => topic, 'event'.freeze => event).freeze
|
28
29
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
30
|
+
self.class.handlers[event].each do |handler|
|
31
|
+
begin
|
32
|
+
if handler.is_a? Proc
|
33
|
+
instance_exec( _payload.dup, &handler )
|
34
|
+
else
|
35
|
+
handler.call( _payload.dup )
|
36
|
+
end
|
37
|
+
rescue => e
|
38
|
+
Sidekiq::EventBus.utils.handle_error(e)
|
35
39
|
end
|
36
|
-
rescue => e
|
37
|
-
puts "OH NO!!!"
|
38
|
-
puts e.inspect
|
39
|
-
puts e.backtrace
|
40
40
|
end
|
41
41
|
end
|
42
42
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sidekiq-eventbus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Phil Monroe
|
@@ -9,8 +9,48 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
date: 2017-01-21 00:00:00.000000000 Z
|
12
|
-
dependencies:
|
13
|
-
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: sidekiq
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 4.0.0
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '5.0'
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 4.0.0
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '5.0'
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: rspec
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ">="
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: 3.5.0
|
40
|
+
- - "<"
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '4.0'
|
43
|
+
type: :development
|
44
|
+
prerelease: false
|
45
|
+
version_requirements: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: 3.5.0
|
50
|
+
- - "<"
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '4.0'
|
53
|
+
description: A simple asynchronous Producer/Consumer event bus extension for Sidekiq
|
14
54
|
email: phil@rakefire.io
|
15
55
|
executables: []
|
16
56
|
extensions: []
|
@@ -54,5 +94,5 @@ rubyforge_project:
|
|
54
94
|
rubygems_version: 2.5.1
|
55
95
|
signing_key:
|
56
96
|
specification_version: 4
|
57
|
-
summary:
|
97
|
+
summary: Producer/Consumer event bus via Sidekiq
|
58
98
|
test_files: []
|