Snoopka
TODO: Write a gem description
Installation
Add this line to your application's Gemfile:
gem 'snoopka'
And then execute:
$ bundle
Or install it yourself as:
$ gem install snoopka
Usage
Sample code:
require 'snoopka'
require 'logger'
# pass the custom behavior as a block
namespace :kafka do
desc 'Starts the kafka listener'
task :listen, [:daemonized] => :environment do |t, args|
Process.daemon(true, true) if args.daemonized
puts 'Starting the Kafka listener'
listener = Snoopka::Listener.new host: "localhost", port: 9092
handler = Handler.new
listener.add_observer 'test', &handler
loop do
listener.consume
end
end
end
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request