stapfen 2.2.0 → 2.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 01629a450316fa2089bd559e2ec2df8bb3b79fe7
4
- data.tar.gz: 84ad17b10f341ca81c599e5aadd7d13fce04cb42
3
+ metadata.gz: ca9dc7da001120adcf33f82c7223b68eabf8d6f6
4
+ data.tar.gz: 3ac1d65ea2159fa5043bb4a33c33da2edf3fb926
5
5
  SHA512:
6
- metadata.gz: 24f9f0557fa24b518b7b957010c4de14db38c04ad4dd81d7f900ece3e783e577f37d2f8fe3226e9896f2409ed1cb92e7e760b078344308d887049e8cef64a890
7
- data.tar.gz: 82ecce67fb2b23c3cb73d47a356de210ef5ebc6f72a03a3fa1108cc1e87e95e47826000965a8c96884fcb5ff2e6db6777acea7dc5dbebf6507a423e40e7dc14a
6
+ metadata.gz: 0f36e12586128c21c87a2e9d401c2e29b83c42003ac57a4518161c4fce0b0897dfe24b93907423553649265c07f2a9ecf694713797779a5641425d68d6038ad1
7
+ data.tar.gz: c2fbfe0c65cebf3e8a4a9c6322866cd01513907aa827ee59d31e332697e594036084645cd1bcdd4347ed27982d958c4f97661005f52a04bba19179b7c59036c7
data/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ language: ruby
2
+ rvm:
3
+ - ruby-head
4
+ - 2.1
5
+ - 1.9.3
6
+ - jruby
7
+
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
@@ -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 List of 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 @topic && @groupId && @zookeepers
31
+ raise ConfigurationError unless @groupId && @zookeepers
32
32
  @connection = Hermann::Consumer.new(@topic, @groupId, @zookeepers)
33
33
  end
34
34
 
@@ -1,3 +1,3 @@
1
1
  module Stapfen
2
- VERSION = '2.2.0'
2
+ VERSION = '2.2.1'
3
3
  end
@@ -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,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stapfen
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 2.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - R. Tyler Croy
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2014-11-03 00:00:00 Z
12
+ date: 2014-11-13 00:00:00 Z
13
13
  dependencies: []
14
14
 
15
15
  description: A simple gem for writing good basic STOMP workers
@@ -23,6 +23,7 @@ extra_rdoc_files: []
23
23
 
24
24
  files:
25
25
  - .gitignore
26
+ - .travis.yml
26
27
  - CHANGES.md
27
28
  - Gemfile
28
29
  - LICENSE.txt