hermann 0.24.1.0 → 0.25.0.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: 7ab2b9a3c3699c6d765e930686fd0fb08df9e244
4
- data.tar.gz: 36e43ca4b80e8428760e80b3ba65d6ff35a43232
3
+ metadata.gz: 4ff7bff5ca0e5889239552386c008c1b94e11f6d
4
+ data.tar.gz: a19b63b8ac206cadac1cef896c887833a0af65ed
5
5
  SHA512:
6
- metadata.gz: 6ba78bfd1051a7e9f13b29d2816bbb7ac973968c081743dcf15fd85a4da7bfdc2c12c5bd7bbef00a13cc089c0489e78c1447238ce4aec59263b71bbf7db67881
7
- data.tar.gz: 7d4d31a0ee898b78fe921778b788d5a661b7d5d6630ecd95053692595f3cf37cb754399fbf30f5221f9ba481b6be0ab5eb23ca226c09a7f38d8d7695f3c413c9
6
+ metadata.gz: 2e4ba622c120225f544eca83eabcd34188dd17d54f7389c50097542afac56f3fe3e39c9b1e0f45207f314a12f2d24e9b6418c548b27979173a7a6dbabb471541
7
+ data.tar.gz: e85a7ff493b1effb19a7170b6ce3c649cbf4430c5f178ee876708c2e8ec3839b769867e2616e8cf13425bb4b3b76d4a2e853fac8a35b7410de13c1ade049182e
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: ruby
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
@@ -66,8 +66,8 @@ extra_rdoc_files: []
66
66
  files:
67
67
  - Rakefile
68
68
  - ext/hermann/extconf.rb
69
- - ext/hermann/hermann_lib.c
70
- - ext/hermann/hermann_lib.h
69
+ - ext/hermann/hermann_rdkafka.c
70
+ - ext/hermann/hermann_rdkafka.h
71
71
  - lib/hermann.rb
72
72
  - lib/hermann/consumer.rb
73
73
  - lib/hermann/discovery/metadata.rb
@@ -107,3 +107,4 @@ signing_key:
107
107
  specification_version: 3
108
108
  summary: A Kafka consumer/producer gem supporting both MRI and JRuby
109
109
  test_files: []
110
+ has_rdoc: