Skip to content

Instantly share code, notes, and snippets.

@blurredbits
Created June 30, 2015 18:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save blurredbits/7fe67db6594a0dd1abf5 to your computer and use it in GitHub Desktop.
Save blurredbits/7fe67db6594a0dd1abf5 to your computer and use it in GitHub Desktop.
Kafka Producer Example
#!/usr/bin/env ruby
require 'poseidon'
producer = Poseidon::Producer.new(["localhost:9092"], "test_producer")
loop do
messages = []
messages << Poseidon::MessageToSend.new("metrics", "timestamp: #{Time.now.to_i}, metric: #{rand(10..30)}")
producer.send_messages(messages)
sleep 3
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment