title: Explain Kinesis Shard Iterator - AWS Java SDK
body: <p>OK, I'll start with an elaborated use-case and will explain my question:</p>
  
  <ol>
  <li>I use a 3rd party web analytics platform which utilizes <strong>AWS Kinesis</strong> streams in order to pass data from the client into the final destination - a Kinesis stream;</li>
  <li>The web analytics platform uses 2 streams:
  <ol>
  <li>A data collector stream (single shard stream);</li>
  <li>A second stream to enrich the raw data from the collector stream (single shard stream); Most importantly, this stream consumes the raw data from the first stream using <code>TRIM_HORIZON</code> iterator type;</li>
  </ol></li>
  <li>I consume the data from the stream using <strong>AWS Java SDK</strong>, secifically using the <code>GetShardIteratorRequest</code> class; </li>
  <li>I'm currently developing the extraction class, so this is done synchronously, meaning I consume data only when I compile my class;</li>
  <li>The class surprisingly works, although there are some things that I fail to understand, specifically with respect to how the data is consumed from the stream and the meaning of each one of iterator types;</li>
  </ol>
  
  <p><strong>My problem</strong> is that the data I retrieve is inconsistent and has no chronological logic in it. </p>
  
  <ul>
  <li><p>When I use <code>AT_SEQUENCE_NUMBER</code> and provide the first sequence number from the shard with         </p>
  
  <p>.getSequenceNumberRange().getStartingSequenceNumber();</p>
  
  <p>... as the ``, I'm not getting all records. Similarly, <code>AFTER_SEQUENCE_NUMBER</code>;</p></li>
  <li>When I use <code>LATEST</code>, I'm getting zero results;</li>
  <li>When I use <code>TRIM_HORIZON</code>, which should make sense to use, it doesn't seem to be working fine. It used to provide me the data, and then I've added new "events" (records to the final stream) and I received zero records. Mystery.</li>
  </ul>
  
  <p><strong>My questions are:</strong> </p>
  
  <ol>
  <li>How can I safely consume data from the stream, without having to worry about missed records? </li>
  <li>Is there an alternative to the <code>ShardIteratorRequest</code>? </li>
  <li>If there is, how can I just "browse" the stream and see what's inside it for debugging references?</li>
  <li>What am I missing with the <code>TRIM_HORIZON</code> method?</li>
  </ol>
  
  <p>Thanks in advance, I'd really love to learn a bit more about data consumption from a Kinesis stream.</p>