Created
April 25, 2023 13:23
-
-
Save IanVaughan/fe7d26d01a11b9ada960c40e77030318 to your computer and use it in GitHub Desktop.
Load test streaming prod data into staging
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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