WisperKafka
Asynchronous event publishing for Wisper using Kafka.
Installation
Add this line to your application's Gemfile:
gem 'wisper_kafka'
And then execute:
$ bundle
Or install it yourself as:
$ gem install wisper_kafka
Usage
Configure DeliveryBoy
https://github.com/zendesk/delivery_boy#configuration
Configure Racecar
https://github.com/zendesk/racecar#installation
Use WisperKafka
Set broadcaster
as :kafka
:
Wisper.subscribe(Subscriber, broadcaster: :kafka)
Setup topic for events
Default topic is: wisper_events
.
You can set it manually:
WisperKafka::Settings.topic = 'custom_topic'
Custom topic and other DeliveryBoy params.
Default params:
{ topic: WisperKafka::Settings.topic }
You can use your own kafka_options
into subscriber.
class Subscriber
def self.kafka_options(event_id:)
partition_key = "event-#{event_id}"
{ topic: 'custom_topic', partition_key: partition_key }
end
def self.new_event(event_id:); end
end
Consumers
You can write your own consumer, or use default WisperKafka::Consumer.
Development
After checking out the repo, run bin/setup
to install dependencies.
You can also run bin/console
for an interactive prompt that will allow you to experiment.
Test
Run rake spec
to run the tests.
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/bookmate/wisper_kafka.
License
The gem is available as open source under the terms of the MIT License.