Created
August 13, 2015 08:51
-
-
Save kenoir/ac4bc9c89d0b748a96ea to your computer and use it in GitHub Desktop.
Dump the contents of a kinesis stream into the console
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
require 'aws-sdk' | |
def dump_stream | |
kinesis = Aws::Kinesis::Client.new(region: 'eu-west-1') | |
iterator = kinesis.get_shard_iterator({ | |
stream_name: "testStream", | |
shard_id: "shardId-000000000000", | |
shard_iterator_type: "LATEST", | |
}) | |
i = iterator.shard_iterator | |
while(true) do | |
s = kinesis.get_records({shard_iterator: i}) | |
i = s.next_shard_iterator | |
#puts "#{i}: #{s.records.length}" | |
s.records.each { |r| puts r.data } | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment