jruby-kafka 0.0.11 → 0.0.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/jruby-kafka/producer.rb +20 -0
  3. metadata +6 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cc47e80137f834c4fe3b60e645448de109195051
4
- data.tar.gz: 7dcefe6ff7852eb7e990368f24a41a5c9e5d61d1
3
+ metadata.gz: 845abef79fc7de08bcbbd20a8de93271fed609e0
4
+ data.tar.gz: 01238f1173d6cca7ccade3968d1847c738bf2290
5
5
  SHA512:
6
- metadata.gz: 5f1569001ee9290610c2fc892cc59a8c5fe6fdbbccd8928e8006add149e5380ecca80a24f8830b9365299ff69c52fc12318b510d59e6a08aa47e534ef1adbe43
7
- data.tar.gz: e26ac69b20b67360b600b62a0aad650322752ec136796fc4bf7425c363e7891902ecf6cc5489afd3e098a00f4559b0d6c3b161b385fc76479a62080a3accf510
6
+ metadata.gz: a862036fd6264456f42a0a993fd985d37b6029f684edf2e03c11d069fd706cfaa6da94d9b7305b1e88fa934ebae3108b68a716a2ea94941ee08dc50144626804
7
+ data.tar.gz: 40c0ce24de712ed6cee5868137628f7070bae96135f02fbbb583c549bf2b2c0c05ac47dabbfc0122fc355d4272bd4c89586644f506bd42c4cfb8a032253c182d
@@ -22,6 +22,8 @@ class Kafka::Producer
22
22
  @serializer_class = 'kafka.serializer.StringEncoder'
23
23
  @partitioner_class = nil
24
24
  @request_required_acks = '0'
25
+ @compression_codec = "#{Java::kafka::message::NoCompressionCodec.name}"
26
+ @compressed_topics = ''
25
27
 
26
28
  if options[:partitioner_class]
27
29
  @partitioner_class = "#{options[:partitioner_class]}"
@@ -30,6 +32,22 @@ class Kafka::Producer
30
32
  if options[:request_required_acks]
31
33
  @request_required_acks = "#{options[:request_required_acks]}"
32
34
  end
35
+
36
+ if options[:compression_codec]
37
+ required_codecs = ["#{Java::kafka::message::NoCompressionCodec.name}",
38
+ "#{Java::kafka::message::GZIPCompressionCodec.name}",
39
+ "#{Java::kafka::message::SnappyCompressionCodec.name}"]
40
+ if not required_codecs.include? options[:compression_codec]
41
+ raise(ArgumentError, "#{options[:compression_codec]} is not one of required codecs: #{required_codecs}")
42
+ end
43
+ @compression_codec = options[:compression_codec]
44
+ end
45
+
46
+ if options[:compressed_topics]
47
+ if @compression_codec != 'none'
48
+ @compressed_topics = options[:compressed_topics]
49
+ end
50
+ end
33
51
  end
34
52
 
35
53
  private
@@ -67,6 +85,8 @@ class Kafka::Producer
67
85
  properties.put("partitioner.class", @partitioner_class)
68
86
  end
69
87
  properties.put("serializer.class", @serializer_class)
88
+ properties.put("compression.codec", @compression_codec)
89
+ properties.put("compressed.topics", @compressed_topics)
70
90
  return Java::kafka::producer::ProducerConfig.new(properties)
71
91
  end
72
92
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jruby-kafka
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.11
4
+ version: 0.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joseph Lawson
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-17 00:00:00.000000000 Z
11
+ date: 2014-01-23 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: this is primarily to be used as an interface for logstash
14
14
  email:
@@ -30,7 +30,7 @@ homepage: https://github.com/joekiller/jruby-kafka
30
30
  licenses:
31
31
  - Apache 2.0
32
32
  metadata: {}
33
- post_install_message:
33
+ post_install_message:
34
34
  rdoc_options: []
35
35
  require_paths:
36
36
  - lib
@@ -46,9 +46,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  requirements: []
49
- rubyforge_project:
49
+ rubyforge_project:
50
50
  rubygems_version: 2.2.1
51
- signing_key:
51
+ signing_key:
52
52
  specification_version: 4
53
53
  summary: jruby Kafka wrapper
54
54
  test_files: []