Update the requires for the sample scripts.

This commit is contained in:
Stan Campbell 2014-09-04 10:52:27 -07:00
parent 8aff9226b7
commit e71ab6cd14
4 changed files with 21 additions and 3 deletions

View File

@ -101,6 +101,18 @@ static void msg_delivered(rd_kafka_t *rk,
if (error_code) {
fprintf(stderr, "%% Message delivery failed: %s\n",
rd_kafka_err2str(error_code));
/* todo: should raise an error? */
} else {
// Yield the data to the Producer's block
if (rb_block_given_p()) {
VALUE value = rb_str_new((char *)payload, len);
rb_yield(value);
}
else {
if (DEBUG) {
fprintf(stderr, "No block given\n"); // todo: should this be an error?
}
}
}
}

View File

@ -1,4 +1,6 @@
require 'hermann'
require 'rubygems'
require 'lib/hermann'
require 'lib/hermann/consumer'
c = Hermann::Consumer.new( "lms_messages", "localhost:9092", 0 )
t1 = 0

View File

@ -1,4 +1,7 @@
require 'hermann'
require 'rubygems'
require 'lib/hermann'
require 'lib/hermann/consumer'
p = Hermann::Producer.new("lms_messages", "localhost:9092")
arr = (0..1000000).to_a.map { |x| "message_#{x}"}
t1 = Time.now

View File

@ -1,7 +1,8 @@
# Produce messages for a given amount of time
require 'rubygems'
require 'hermann'
require 'lib/hermann'
require 'lib/hermann/consumer'
stopTime = Time.now + 60 # One minute from now
p = Hermann::Producer.new("lms_messages")