Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed .DS_Store
Binary file not shown.
26 changes: 26 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
PATH
remote: .
specs:
leffen-kafka-rb (0.0.15)

GEM
remote: https://rubygems.org/
specs:
diff-lcs (1.2.2)
rake (10.0.4)
rspec (2.13.0)
rspec-core (~> 2.13.0)
rspec-expectations (~> 2.13.0)
rspec-mocks (~> 2.13.0)
rspec-core (2.13.1)
rspec-expectations (2.13.0)
diff-lcs (>= 1.1.3, < 2.0)
rspec-mocks (2.13.1)

PLATFORMS
ruby

DEPENDENCIES
leffen-kafka-rb!
rake
rspec
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ require 'rubygems/specification'
require 'date'
require 'rspec/core/rake_task'

spec = eval(File.open("kafka-rb.gemspec", "r").read)
spec = eval(File.open("leffen-kafka-rb.gemspec", "r").read)

Gem::PackageTask.new(spec) do |pkg|
pkg.gem_spec = spec
Expand Down
File renamed without changes.
File renamed without changes.
Binary file added leffen-kafka-rb-0.0.15.gem
Binary file not shown.
7 changes: 4 additions & 3 deletions kafka-rb.gemspec → leffen-kafka-rb.gemspec
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
Gem::Specification.new do |s|
s.name = %q{kafka-rb}
s.name = %q{leffen-kafka-rb}
s.version = "0.0.15"

s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Alejandro Crosa", "Stefan Mees", "Tim Lossen", "Liam Stewart"]
s.autorequire = %q{kafka-rb}
s.email = 'leffen@gmail.com'
s.homepage = 'http://tomlea.co.uk/p/gem-in-a-box'
s.date = Time.now.strftime("%Y-%m-%d")
s.description = %q{kafka-rb allows you to produce and consume messages using the Kafka distributed publish/subscribe messaging service.}
s.extra_rdoc_files = ["LICENSE"]
Expand All @@ -13,7 +14,7 @@ Gem::Specification.new do |s|
s.homepage = %q{http://github.com/acrosa/kafka-rb}
s.require_paths = ["lib"]
s.summary = %q{A Ruby client for the Kafka distributed publish/subscribe messaging service}
s.executables = ["kafka-consumer", "kafka-publish"]
s.executables = ["leffen-kafka-consumer", "leffen-kafka-publish"]

if s.respond_to? :specification_version then
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
Expand Down
2 changes: 1 addition & 1 deletion lib/kafka/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def option_parser
end

def publish?
program_name == "kafka-publish"
program_name == "leffen-kafka-publish"
end

def subscribe?
Expand Down
11 changes: 8 additions & 3 deletions lib/kafka/consumer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,18 @@ def consume
end

def fetch_latest_offset
send_offsets_request
send_offsets_request(LATEST_OFFSET)
read_offsets_response
end

def send_offsets_request
def fetch_earliest_offset
send_offsets_request(EARLIEST_OFFSET)
read_offsets_response
end

def send_offsets_request(offset)
write(encoded_request_size)
write(encode_request(Kafka::RequestType::OFFSETS, topic, partition, LATEST_OFFSET, MAX_OFFSETS))
write(encode_request(Kafka::RequestType::OFFSETS, topic, partition, offset, MAX_OFFSETS))
end

def read_offsets_response
Expand Down
16 changes: 16 additions & 0 deletions lib/leffen-kafka.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

require File.join(File.dirname(__FILE__), "kafka")