stapfen 2.2.0-java → 2.2.1-java
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/.travis.yml +7 -0
- data/README.md +27 -0
- data/lib/stapfen/client/kafka.rb +2 -2
- data/lib/stapfen/version.rb +1 -1
- data/spec/client/kafka_spec.rb +16 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: beee0b9ecf2b0bf8909a85b028254ebd1c3cb2e7
|
4
|
+
data.tar.gz: 93521fe82ee23ca8fa9760521032db5f483a1012
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b12dfa7d9ff8417e02fe3dc7ca780dc256ff9dd832281178510e1d72d2a54679ab34db983491df3647458576d029b81c29a9b004cc18c1cc01b2d1974de0dab3
|
7
|
+
data.tar.gz: b030c53f61d78525cddad2067b6fea5fcf2d389ea783c7f2d2ae76e3bb005fe26a668dfbece734886172f188a1a15b331a87778a7ed046d2655c44dd1fd900f8
|
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -67,6 +67,33 @@ is expected to be a valid [configuration
|
|
67
67
|
hash](https://github.com/reidmorrison/jruby-jms#consumer) for the
|
68
68
|
[jruby-jms](https://github.com/reidmorrison/jruby-jms) gem.
|
69
69
|
|
70
|
+
#### Kafka example
|
71
|
+
|
72
|
+
Using with Kafka requires a configuration with the topic, groupID, and zookeepers string.
|
73
|
+
|
74
|
+
```ruby
|
75
|
+
require 'stapfen'
|
76
|
+
require 'stapfen/worker'
|
77
|
+
|
78
|
+
class MyWorker < Stapfen::Worker
|
79
|
+
use_kafka!
|
80
|
+
|
81
|
+
configure do
|
82
|
+
{
|
83
|
+
:topic => 'test', # not required
|
84
|
+
:groupId => 'groupId',
|
85
|
+
:zookeepers => 'localhost:2181' # comma separated string of zookeepers
|
86
|
+
}
|
87
|
+
end
|
88
|
+
|
89
|
+
# /topic/test - topic says its a topic, test is the actual topic name
|
90
|
+
consume '/topic/test' do |message|
|
91
|
+
puts "Recv: #{message.body}"
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
MyWorker.run!
|
96
|
+
```
|
70
97
|
---
|
71
98
|
|
72
99
|
It is also important to note that the `consume` block will be invoked inside an
|
data/lib/stapfen/client/kafka.rb
CHANGED
@@ -19,7 +19,7 @@ module Stapfen
|
|
19
19
|
# @params [Hash] configuration object
|
20
20
|
# @option configuration [String] :topic The kafka topic
|
21
21
|
# @option configuration [String] :groupId The kafka groupId
|
22
|
-
# @option configuration [String] :zookeepers
|
22
|
+
# @option configuration [String] :zookeepers Comma separated list of zookeepers
|
23
23
|
#
|
24
24
|
# @raises [ConfigurationError] if required configs are not present
|
25
25
|
def initialize(configuration)
|
@@ -28,7 +28,7 @@ module Stapfen
|
|
28
28
|
@topic = @config[:topic]
|
29
29
|
@groupId = @config[:groupId]
|
30
30
|
@zookeepers = @config[:zookeepers]
|
31
|
-
raise ConfigurationError unless @
|
31
|
+
raise ConfigurationError unless @groupId && @zookeepers
|
32
32
|
@connection = Hermann::Consumer.new(@topic, @groupId, @zookeepers)
|
33
33
|
end
|
34
34
|
|
data/lib/stapfen/version.rb
CHANGED
data/spec/client/kafka_spec.rb
CHANGED
@@ -14,6 +14,22 @@ describe Stapfen::Client::Kafka, :java => true do
|
|
14
14
|
|
15
15
|
it { should respond_to :connect }
|
16
16
|
|
17
|
+
|
18
|
+
describe '#initialize' do
|
19
|
+
context 'with valid input params' do
|
20
|
+
it 'should be a object' do
|
21
|
+
expect(client).to be_a described_class
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
context 'without valid input params' do
|
26
|
+
let(:config) { {} }
|
27
|
+
it 'should raise error' do
|
28
|
+
expect{ client }.to raise_error(Stapfen::ConfigurationError)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
17
33
|
describe '#can_unreceive?' do
|
18
34
|
subject { client.can_unreceive? }
|
19
35
|
it { should be false }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stapfen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.1
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- R. Tyler Croy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-11-
|
11
|
+
date: 2014-11-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -32,6 +32,7 @@ extensions: []
|
|
32
32
|
extra_rdoc_files: []
|
33
33
|
files:
|
34
34
|
- .gitignore
|
35
|
+
- .travis.yml
|
35
36
|
- CHANGES.md
|
36
37
|
- Gemfile
|
37
38
|
- LICENSE.txt
|