Skip to content

Instantly share code, notes, and snippets.

@ifyouseewendy
Created November 6, 2018 20:45
Show Gist options
  • Save ifyouseewendy/40a0f31a305dde152d822894e4917444 to your computer and use it in GitHub Desktop.
Save ifyouseewendy/40a0f31a305dde152d822894e4917444 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment