karafka-sidekiq-backend 1.2.0.beta3 → 1.2.0.beta4
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 +4 -4
- data/CHANGELOG.md +1 -2
- data/Gemfile.lock +5 -5
- data/README.md +4 -4
- data/karafka-sidekiq-backend.gemspec +2 -2
- data/lib/karafka-sidekiq-backend.rb +1 -1
- data/lib/karafka/backends/sidekiq.rb +1 -1
- data/lib/karafka/interchanger.rb +11 -10
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 57e4580e9858d6475c1461199217e1aba83091c90de3802457e9a2245a5700c1
|
4
|
+
data.tar.gz: 57771eedaf99af86108ccebdc7518c442c04ba0a340641a9af616d6601766f87
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 44fff2bb75bc5d3c6a0345920c4ff00e8d9d97467d570e95881749ff0a7cab408c64230eae1de01f2280e4a3b020b93c43203001ab6f208d2227094110f7a1fd
|
7
|
+
data.tar.gz: 87795d7271e8a20177c251bb8bdad8044844ce1aa9334538b148de3584102e25668abf48149593c0807f82359dd6bc3de66251675a6c2aea324bcf9b3bae5b20
|
data/CHANGELOG.md
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
# Karafka Sidekiq Backend
|
2
2
|
|
3
|
-
## 1.2.0.
|
3
|
+
## 1.2.0.beta4
|
4
4
|
- ```#load``` and ```#parse``` are renamed to ```#encode``` and ```#decode``` in interchangers
|
5
|
-
- Default interchanger is not Base64 Marshal dump
|
6
5
|
- #274 - Rename controllers to consumers
|
7
6
|
- Karafka 1.2 support
|
8
7
|
- Parse data before pushing to Sidekiq
|
data/Gemfile.lock
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
karafka-sidekiq-backend (1.2.0.
|
5
|
-
karafka (>= 1.2.0.
|
4
|
+
karafka-sidekiq-backend (1.2.0.beta4)
|
5
|
+
karafka (>= 1.2.0.beta4)
|
6
6
|
sidekiq (>= 4.2)
|
7
7
|
|
8
8
|
GEM
|
@@ -63,7 +63,7 @@ GEM
|
|
63
63
|
concurrent-ruby (~> 1.0)
|
64
64
|
inflecto (0.0.2)
|
65
65
|
json (2.1.0)
|
66
|
-
karafka (1.2.0.
|
66
|
+
karafka (1.2.0.beta4)
|
67
67
|
activesupport (>= 4.0)
|
68
68
|
dry-configurable (~> 0.7)
|
69
69
|
dry-inflector (~> 0.1.1)
|
@@ -75,7 +75,7 @@ GEM
|
|
75
75
|
require_all (>= 1.4)
|
76
76
|
ruby-kafka (>= 0.5.3)
|
77
77
|
thor (~> 0.19)
|
78
|
-
waterdrop (
|
78
|
+
waterdrop (~> 1.2)
|
79
79
|
king_konf (0.1.10)
|
80
80
|
minitest (5.11.3)
|
81
81
|
multi_json (1.13.1)
|
@@ -85,7 +85,7 @@ GEM
|
|
85
85
|
rack
|
86
86
|
rake (12.3.0)
|
87
87
|
redis (4.0.1)
|
88
|
-
require_all (
|
88
|
+
require_all (2.0.0)
|
89
89
|
rouge (2.2.1)
|
90
90
|
rspec (3.7.0)
|
91
91
|
rspec-core (~> 3.7.0)
|
data/README.md
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
# Karafka Sidekiq Backend
|
2
2
|
|
3
|
-
[](https://travis-ci.org/karafka/karafka-sidekiq-backend)
|
4
4
|
[](https://gitter.im/karafka/karafka?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
5
5
|
|
6
|
-
[Karafka Sidekiq Backend](https://github.com/karafka/
|
6
|
+
[Karafka Sidekiq Backend](https://github.com/karafka/sidekiq-backend) provides support for consuming (processing) received Kafka messages inside of Sidekiq workers.
|
7
7
|
|
8
8
|
## Installations
|
9
9
|
|
@@ -47,7 +47,7 @@ App.routes.draw do
|
|
47
47
|
topic :binary_video_details do
|
48
48
|
controller Videos::DetailsController
|
49
49
|
worker Workers::DetailsWorker
|
50
|
-
interchanger Interchangers::
|
50
|
+
interchanger Interchangers::MyCustomInterchanger
|
51
51
|
end
|
52
52
|
end
|
53
53
|
end
|
@@ -62,7 +62,7 @@ There are two options you can set inside of the ```topic``` block:
|
|
62
62
|
| Option | Value type | Description |
|
63
63
|
|--------------|------------|-------------------------------------------------------------------------------------------------------------------|
|
64
64
|
| worker | Class | Name of a worker class that we want to use to schedule perform code |
|
65
|
-
| interchanger | Class | Name of
|
65
|
+
| interchanger | Class | Name of an interchanger class that we want to use to pass the incoming data to Sidekiq |
|
66
66
|
|
67
67
|
|
68
68
|
### Workers
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
lib = File.expand_path('
|
3
|
+
lib = File.expand_path('lib', __dir__)
|
4
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
5
|
require 'karafka/backends/sidekiq'
|
6
6
|
|
@@ -15,7 +15,7 @@ Gem::Specification.new do |spec|
|
|
15
15
|
spec.description = 'Karafka Sidekiq backend for background messages processing'
|
16
16
|
spec.license = 'MIT'
|
17
17
|
|
18
|
-
spec.add_dependency 'karafka', '>= 1.2.0.
|
18
|
+
spec.add_dependency 'karafka', '>= 1.2.0.beta4'
|
19
19
|
spec.add_dependency 'sidekiq', '>= 4.2'
|
20
20
|
spec.required_ruby_version = '>= 2.3.0'
|
21
21
|
|
@@ -5,7 +5,7 @@ module Karafka
|
|
5
5
|
# Sidekiq backend that schedules stuff to Sidekiq worker for delayed execution
|
6
6
|
module Sidekiq
|
7
7
|
# Karafka Sidekiq backend version
|
8
|
-
VERSION = '1.2.0.
|
8
|
+
VERSION = '1.2.0.beta4'
|
9
9
|
|
10
10
|
# Enqueues the execution of perform method into a worker.
|
11
11
|
# @note Each worker needs to have a class #perform_async method that will allow us to pass
|
data/lib/karafka/interchanger.rb
CHANGED
@@ -8,25 +8,26 @@ module Karafka
|
|
8
8
|
# - encode - it is meant to encode params before they get stored inside Redis
|
9
9
|
# - decode - decoded params back to a hash format that we can use
|
10
10
|
#
|
11
|
-
# This interchanger
|
12
|
-
#
|
11
|
+
# This interchanger uses default Sidekiq options to exchange data
|
12
|
+
# @note Since we use symbols for Karafka params (performance reasons), they will be
|
13
|
+
# deserialized into string versions. Keep that in mind.
|
13
14
|
class Interchanger
|
14
15
|
class << self
|
15
16
|
# @param params_batch [Karafka::Params::ParamsBatch] Karafka params batch object
|
16
|
-
# @
|
17
|
-
# own interchanger logic, this method needs to return data that can be converted to
|
18
|
-
# json with default Sidekiqs logic
|
19
|
-
# @return [String] parsed params batch encoded into a string. There are too many problems
|
17
|
+
# @return [Karafka::Params::ParamsBatch] parsed params batch. There are too many problems
|
20
18
|
# with passing unparsed data from Karafka to Sidekiq, to make it a default. In case you
|
21
19
|
# need this, please implement your own interchanger.
|
22
20
|
def encode(params_batch)
|
23
|
-
|
21
|
+
params_batch.parsed
|
24
22
|
end
|
25
23
|
|
26
|
-
# @param params_batch [
|
27
|
-
# @
|
24
|
+
# @param params_batch [Array<Hash>] Sidekiq params that are now an array
|
25
|
+
# @note Since Sidekiq does not like symbols, we restore symbolized keys for system keys, so
|
26
|
+
# everything can work as expected. Keep in mind, that custom data will always be assigned
|
27
|
+
# with string keys per design. To change it, please change this interchanger and create
|
28
|
+
# your own custom parser
|
28
29
|
def decode(params_batch)
|
29
|
-
|
30
|
+
params_batch
|
30
31
|
end
|
31
32
|
end
|
32
33
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: karafka-sidekiq-backend
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.0.
|
4
|
+
version: 1.2.0.beta4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Maciej Mensfeld
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-03-
|
11
|
+
date: 2018-03-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: karafka
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.2.0.
|
19
|
+
version: 1.2.0.beta4
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.2.0.
|
26
|
+
version: 1.2.0.beta4
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: sidekiq
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|