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 +4 -4
- data/Rakefile +1 -1
- data/ext/hermann/extconf.rb +1 -1
- data/ext/hermann/{hermann_lib.c → hermann_rdkafka.c} +21 -11
- data/ext/hermann/{hermann_lib.h → hermann_rdkafka.h} +2 -2
- data/lib/hermann/consumer.rb +2 -2
- data/lib/hermann/discovery/metadata.rb +2 -2
- data/lib/hermann/producer.rb +2 -2
- data/lib/hermann/version.rb +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ff7bff5ca0e5889239552386c008c1b94e11f6d
|
4
|
+
data.tar.gz: a19b63b8ac206cadac1cef896c887833a0af65ed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e4ba622c120225f544eca83eabcd34188dd17d54f7389c50097542afac56f3fe3e39c9b1e0f45207f314a12f2d24e9b6418c548b27979173a7a6dbabb471541
|
7
|
+
data.tar.gz: e85a7ff493b1effb19a7170b6ce3c649cbf4430c5f178ee876708c2e8ec3839b769867e2616e8cf13425bb4b3b76d4a2e853fac8a35b7410de13c1ade049182e
|
data/Rakefile
CHANGED
data/ext/hermann/extconf.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
*
|
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 "
|
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
|
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
|
-
|
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::
|
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
|
-
*
|
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
|
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::
|
1212
|
+
TRACER("setting up Hermann::Provider::RDKafka\n");
|
1203
1213
|
|
1204
1214
|
/* Define the module */
|
1205
1215
|
hermann_module = rb_define_module("Hermann");
|
1206
|
-
|
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
|
-
*
|
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::
|
110
|
+
/* Hermann::Provider::RDKafka::Producer */
|
111
111
|
hermann_conf_t *producer;
|
112
112
|
/* Hermann::Result */
|
113
113
|
VALUE result;
|
data/lib/hermann/consumer.rb
CHANGED
@@ -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 '
|
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::
|
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 '
|
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::
|
23
|
+
@internal = Hermann::Provider::RDKafka::Producer.new(brokers)
|
24
24
|
@timeout = options[:timeout] || DEFAULT_TIMEOUT_MS
|
25
25
|
end
|
26
26
|
|
data/lib/hermann/producer.rb
CHANGED
@@ -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 '
|
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::
|
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
|
data/lib/hermann/version.rb
CHANGED
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.
|
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-
|
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/
|
70
|
-
- ext/hermann/
|
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:
|