Skip to content

Instantly share code, notes, and snippets.

@ifyouseewendy
Created November 6, 2018 20:45
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 ifyouseewendy/8bf7df854cc6061c5971718c4d3a716b to your computer and use it in GitHub Desktop.
Save ifyouseewendy/8bf7df854cc6061c5971718c4d3a716b to your computer and use it in GitHub Desktop.
require "bundler/setup"
require "kafka"
def foo(msg)
puts "=="*50
kafka = Kafka.new(
seed_brokers: ["shopify.railgun:9092"],
client_id: "flow_rails_whatever",
logger: Logger.new(STDOUT)
)
producer = kafka.producer
producer.produce( msg, topic: "flow_runs")
producer.deliver_messages
rescue => _
end
# corrupted
puts ">> corrupted"
msg = "1" * 32760
foo(msg)
puts "<<"*20
# not corrupted
puts ">> not corrupted"
msg = "1" * 32759
foo(msg)
puts "<<"*20
@ifyouseewendy
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment