Skip to content

Instantly share code, notes, and snippets.

@IanVaughan
Created April 25, 2023 13:23
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 IanVaughan/fe7d26d01a11b9ada960c40e77030318 to your computer and use it in GitHub Desktop.
Save IanVaughan/fe7d26d01a11b9ada960c40e77030318 to your computer and use it in GitHub Desktop.
Load test streaming prod data into staging
#!/usr/bin/env ruby
require 'delivery_boy'
# topic = 'raw-transactions-truelayer'
topic = ARGV[0]
command = "stream-kafka #{topic}"
CONFIG = {
brokers: ['---.europe-west1.gcp.confluent.cloud:9092'],
producer: { sasl_username: '...', sasl_password: '...' }
}.freeze
DeliveryBoy.configure do |config|
config.client_id = 'cas_load_test'
config.brokers = CONFIG.fetch(:brokers)
config.sasl_plain_username = CONFIG.dig(:producer, :sasl_username)
config.sasl_plain_password = CONFIG.dig(:producer, :sasl_password)
config.ssl_ca_certs_from_system = true
config.log_level = 'error'
end
IO.popen(command).each do |line|
payload = line.split(' : ').last
puts payload
DeliveryBoy.deliver(payload, topic:)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment