hermann 0.24.1.0-java → 0.25.0.1-java

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: 36258654c7dab0d22f5605f7570e9af0bc1d413f
4
- data.tar.gz: 6a76a7fe69d25b7ca81b729ead0bb443fbb89e64
3
+ metadata.gz: 7805fc3863f703bc692c4b555039124d5b64fd96
4
+ data.tar.gz: 6f754d5124d799dad76fa213068da2e921d079ad
5
5
  SHA512:
6
- metadata.gz: 7e12d640758271fbc235823e3cb1990c63fc6140160e79ca3b40204ffc3a696a57b92bd4ccc09150b692532ea427147d4ee84c41ba8d5a0939657ba82bb51061
7
- data.tar.gz: c9dd57c7ffac7ed14b29b0c76bb2dc048226c381608c772bdef86c653e18ff12b0563268c789929d9964acd339ae66d03afe041fd6ce71869d209487cf63049e
6
+ metadata.gz: cea1725e6f06bfdd6eb106052c7493464cf4b3061ef69115a3243cb5716f473b0affa0c2e56f86bbe3247a8e254bce822d344874e47c20002102a75e715d7862
7
+ data.tar.gz: 673769cf7fa08974e0d78b7b5609186933ad381f57f761b2e9b525f0527326a380fb6e73fd2ab59ed7902b531ee3faec62f34e3e72dc927c65f4fb848731d6e9
data/Rakefile CHANGED
@@ -6,7 +6,7 @@ require 'rake/extensiontask'
6
6
 
7
7
 
8
8
  Rake::ExtensionTask.new do |t|
9
- t.name = 'hermann_lib'
9
+ t.name = 'hermann_rdkafka'
10
10
  t.ext_dir = 'ext/hermann'
11
11
  t.gem_spec = Gem::Specification.load('hermann.gemspec')
12
12
  end
@@ -151,4 +151,4 @@ have_header('ruby/version.h')
151
151
  have_func('rb_thread_blocking_region')
152
152
  have_func('rb_thread_call_without_gvl')
153
153
 
154
- create_makefile('hermann/hermann_lib')
154
+ create_makefile('hermann/hermann_rdkafka')
@@ -1,5 +1,5 @@
1
1
  /*
2
- * hermann_lib.c - Ruby wrapper for the librdkafka library
2
+ * hermann_rdkafka.c - Ruby wrapper for the librdkafka library
3
3
  *
4
4
  * Copyright (c) 2014 Stan Campbell
5
5
  * Copyright (c) 2014 Lookout, Inc.
@@ -31,7 +31,7 @@
31
31
 
32
32
  /* Much of the librdkafka library calls were lifted from rdkafka_example.c */
33
33
 
34
- #include "hermann_lib.h"
34
+ #include "hermann_rdkafka.h"
35
35
 
36
36
  #ifdef HAVE_RUBY_VERSION_H
37
37
  #include <ruby/version.h>
@@ -264,9 +264,19 @@ static void msg_consume(rd_kafka_message_t *rkmessage, HermannInstanceConfig *cf
264
264
 
265
265
  // Yield the data to the Consumer's block
266
266
  if (rb_block_given_p()) {
267
- VALUE value = rb_str_new((char *)rkmessage->payload, rkmessage->len);
267
+ VALUE key, data, offset;
268
+
269
+ data = rb_str_new((char *)rkmessage->payload, rkmessage->len);
270
+ offset = rb_ll2inum(rkmessage->offset);
271
+
272
+ if ( rkmessage->key_len > 0 ) {
273
+ key = rb_str_new((char*) rkmessage->key, (int)rkmessage->key_len);
274
+ } else {
275
+ key = Qnil;
276
+ }
277
+
268
278
  rd_kafka_message_destroy(rkmessage);
269
- rb_yield(value);
279
+ rb_yield_values(3, data, key, offset);
270
280
  }
271
281
  else {
272
282
  if (DEBUG) {
@@ -444,7 +454,7 @@ static VALUE consumer_consume_loop_stop(VALUE self) {
444
454
  }
445
455
 
446
456
  /**
447
- * Hermann::Lib::Consumer.consume
457
+ * Hermann::Provider::RDKafka::Consumer.consume
448
458
  *
449
459
  * @param VALUE self the Ruby object for this consumer
450
460
  * @param VALUE topic the Ruby string representing a topic to consume
@@ -1190,21 +1200,21 @@ static VALUE producer_init_copy(VALUE copy,
1190
1200
  }
1191
1201
 
1192
1202
  /**
1193
- * Init_hermann_lib
1203
+ * Init_hermann_rdkafka
1194
1204
  *
1195
1205
  * Called by Ruby when the Hermann gem is loaded.
1196
1206
  * Defines the Hermann module.
1197
1207
  * Defines the Producer and Consumer classes.
1198
1208
  */
1199
- void Init_hermann_lib() {
1200
- VALUE lib_module, c_consumer, c_producer;
1209
+ void Init_hermann_rdkafka() {
1210
+ VALUE lib_module, provider_module, c_consumer, c_producer;
1201
1211
 
1202
- TRACER("setting up Hermann::Lib\n");
1212
+ TRACER("setting up Hermann::Provider::RDKafka\n");
1203
1213
 
1204
1214
  /* Define the module */
1205
1215
  hermann_module = rb_define_module("Hermann");
1206
- lib_module = rb_define_module_under(hermann_module, "Lib");
1207
-
1216
+ provider_module = rb_define_module_under(hermann_module, "Provider");
1217
+ lib_module = rb_define_module_under(provider_module, "RDKafka");
1208
1218
 
1209
1219
  /* ---- Define the consumer class ---- */
1210
1220
  c_consumer = rb_define_class_under(lib_module, "Consumer", rb_cObject);
@@ -1,5 +1,5 @@
1
1
  /*
2
- * hermann_lib.h - Ruby wrapper for the librdkafka library
2
+ * hermann_rdkafka.h - Ruby wrapper for the librdkafka library
3
3
  *
4
4
  * Copyright (c) 2014 Stan Campbell
5
5
  * Copyright (c) 2014 Lookout, Inc.
@@ -107,7 +107,7 @@ typedef struct HermannInstanceConfig {
107
107
  typedef HermannInstanceConfig hermann_conf_t;
108
108
 
109
109
  typedef struct {
110
- /* Hermann::Lib::Producer */
110
+ /* Hermann::Provider::RDKafka::Producer */
111
111
  hermann_conf_t *producer;
112
112
  /* Hermann::Result */
113
113
  VALUE result;
@@ -4,7 +4,7 @@ require 'hermann/errors'
4
4
  if Hermann.jruby?
5
5
  require 'hermann/provider/java_simple_consumer'
6
6
  else
7
- require 'hermann_lib'
7
+ require 'hermann_rdkafka'
8
8
  end
9
9
 
10
10
  module Hermann
@@ -37,7 +37,7 @@ module Hermann
37
37
  else
38
38
  brokers, partition = require_values_at(opts, :brokers, :partition)
39
39
 
40
- @internal = Hermann::Lib::Consumer.new(topic, brokers, partition, offset)
40
+ @internal = Hermann::Provider::RDKafka::Consumer.new(topic, brokers, partition, offset)
41
41
  end
42
42
  end
43
43
 
@@ -1,4 +1,4 @@
1
- require 'hermann_lib'
1
+ require 'hermann_rdkafka'
2
2
  require 'hermann/consumer'
3
3
 
4
4
  module Hermann
@@ -20,7 +20,7 @@ module Hermann
20
20
  DEFAULT_TIMEOUT_MS = 2_000
21
21
  def initialize(brokers, options = {})
22
22
  raise "this is an MRI api only!" if Hermann.jruby?
23
- @internal = Hermann::Lib::Producer.new(brokers)
23
+ @internal = Hermann::Provider::RDKafka::Producer.new(brokers)
24
24
  @timeout = options[:timeout] || DEFAULT_TIMEOUT_MS
25
25
  end
26
26
 
@@ -6,7 +6,7 @@ require 'hermann/result'
6
6
  if RUBY_PLATFORM == "java"
7
7
  require 'hermann/provider/java_producer'
8
8
  else
9
- require 'hermann_lib'
9
+ require 'hermann_rdkafka'
10
10
  end
11
11
 
12
12
  module Hermann
@@ -23,7 +23,7 @@ module Hermann
23
23
  if Hermann.jruby?
24
24
  @internal = Hermann::Provider::JavaProducer.new(brokers.join(','), opts)
25
25
  else
26
- @internal = Hermann::Lib::Producer.new(brokers.join(','))
26
+ @internal = Hermann::Provider::RDKafka::Producer.new(brokers.join(','))
27
27
  end
28
28
  # We're tracking children so we can make sure that at Producer exit we
29
29
  # make a reasonable attempt to clean up outstanding result objects
@@ -1,3 +1,3 @@
1
1
  module Hermann
2
- VERSION = '0.24.1'
2
+ VERSION = '0.25.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hermann
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.24.1.0
4
+ version: 0.25.0.1
5
5
  platform: java
6
6
  authors:
7
7
  - R. Tyler Croy
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-06-19 00:00:00.000000000 Z
13
+ date: 2015-07-15 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: json
@@ -79,8 +79,8 @@ extra_rdoc_files: []
79
79
  files:
80
80
  - Rakefile
81
81
  - ext/hermann/extconf.rb
82
- - ext/hermann/hermann_lib.c
83
- - ext/hermann/hermann_lib.h
82
+ - ext/hermann/hermann_rdkafka.c
83
+ - ext/hermann/hermann_rdkafka.h
84
84
  - lib/hermann.rb
85
85
  - lib/hermann/consumer.rb
86
86
  - lib/hermann/discovery/metadata.rb