mhart / kinesalite

An implementation of Amazon's Kinesis built on LevelDB
MIT License
808 stars 86 forks source link

Unnable to get records put in a stream #79

Closed javiersvg closed 5 years ago

javiersvg commented 6 years ago

I am using the aws cli with the lates version of kinesalite and I am not able to retrieve the records I save into a kinesis stream.

Command I use to get kinesalite running:

npm install -g kinesalite
kinesalite --port 4568

Create a stream

aws --endpoint-url=http://localhost:4568 kinesis create-stream --stream-name my-stream --shard-count 2

Put record

$  aws --endpoint-url=http://localhost:4568 kinesis put-record --data "HELLO" --partition-key 0 --stream-name my-stream
{
    "ShardId": "shardId-000000000001",
    "SequenceNumber": "49589238005775633934916144566022322418012108603250442258"
}

Get shard iterator

$ aws --endpoint-url=http://localhost:4568 kinesis get-shard-iterator --stream-name my-stream --shard-id shardId-000000000001 --shard-iterator-type LATEST                                                                                       {
    "ShardIterator": "AAAAAAAAAAEhipAQsczGeJmaJQ6QWCGlB8NG5tJAgDM4dn4bo+Czt0jd1g/TAMcJAFk+dR7XXAiU5DYZcdLVQRebHI6eEQpWfj1Ak04Ky3r0UozKuM+EFZ+HzLGxWYPrCYCs8bL51bi6tPXFkjhCDeyw9ZW+sSsN4GdraihbPh30bwOw2dEM1vBUce5oW0+j81BtnqM2uMsxg58MhCUinaXDtBlJdQXObB6wsBjbZpfyfNU2TDWp+A=="
}

Get records

$ aws --endpoint-url=http://localhost:4568 kinesis get-records --shard-iterator AAAAAAAAAAEhipAQsczGeJmaJQ6QWCGlB8NG5tJAgDM4dn4bo+Czt0jd1g/TAMcJAFk+dR7XXAiU5DYZcdLVQRebHI6eEQpWfj1Ak04Ky3r0UozKuM+EFZ+HzLGxWYPrCYCs8bL51bi6tPXFkjhCDeyw9ZW+sSsN4GdraihbPh30bwOw2dEM1vBUce5oW0+j81BtnqM2uMsxg58MhCUinaXDtBlJdQXObB6wsBjbZpfyfNU2TDWp+A==
{
    "Records": [],
    "NextShardIterator": "AAAAAAAAAAFEb/kC1D5c2aeBOsb2ZugxKeFSHSIWGv908wcre54r9POsk7MK71MtCK7aPh1RbgH5wxzAGNPNGdQyyhefNFM/YTPDf9WRISClgBuCfU2IMaHAzEOjCmyqe2SYLytOX8fJcX7jFeA/RpcU9lz3IKb2lBVaGdxCgHgjBvTC6hoPGnmMXr7FaQfQDMe+G41SLbwTZsAyRVCi8vqkErUrG4yGiNzE35QE3EdujVNBwvZc3Q==",
    "MillisBehindLatest": 0
}

Please advice if there is something I am missing to be able to see the messages I save.

mrobinsn commented 5 years ago

@javiersvg Try using TRIM_HORIZON instead of LATEST.

LATEST means that the iterator will start at the end of the current stream. Meaning you will not see your record since you published it before you got the shard iterator.

javiersvg commented 5 years ago

Oh I see. Thank you very much it worked perfectlly.