Asynchronous event publishing for Wisper using Kafka.
Add this line to your application's Gemfile:
gem 'wisper_kafka'
And then execute:
$ bundle
Or install it yourself as:
$ gem install wisper_kafka
https://github.com/zendesk/delivery_boy#configuration
https://github.com/zendesk/racecar#installation
Set broadcaster
as :kafka
:
Wisper.subscribe(Subscriber, broadcaster: :kafka)
Default topic is: wisper_events
.
You can set it manually:
WisperKafka::Settings.topic = 'custom_topic'
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
You can write your own consumer, or use default WisperKafka::Consumer.
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.
Run rake spec
to run the tests.
Bug reports and pull requests are welcome on GitHub at https://github.com/bookmate/wisper_kafka.
The gem is available as open source under the terms of the MIT License.