title: Unable to read Kinesis stream from SparkStreaming
body: <pre><code>import org.apache.spark.SparkConf
  import org.apache.spark.storage.StorageLevel
  import org.apache.spark.streaming.Milliseconds
  import org.apache.spark.streaming.StreamingContext
  import org.apache.spark.streaming.dstream.DStream.toPairDStreamFunctions
  
  import com.amazonaws.auth.AWSCredentials
  import com.amazonaws.auth.DefaultAWSCredentialsProviderChain
  import com.amazonaws.auth.SystemPropertiesCredentialsProvider
  import com.amazonaws.services.kinesis.AmazonKinesisClient
  import com.amazonaws.services.kinesis.clientlibrary.lib.worker.InitialPositionInStream
  import org.apache.spark.streaming.kinesis.KinesisInputDStream
  import org.apache.spark.streaming.kinesis.KinesisInitialPositions.Latest
  import org.apache.spark.streaming.kinesis.KinesisInitialPositions.TrimHorizon
  import java.util.Date
  
  
  
      val tStream = KinesisInputDStream.builder
              .streamingContext(ssc)
              .streamName(streamName)
              .endpointUrl(endpointUrl)
              .regionName(regionName)
              .initialPosition(new TrimHorizon())
              .checkpointAppName(appName)
              .checkpointInterval(kinesisCheckpointInterval)
              .storageLevel(StorageLevel.MEMORY_AND_DISK_2)
              .build()
      tStream.foreachRDD(rdd =&gt; if (rdd.count() &gt; 0) rdd.saveAsTextFile("/user/hdfs/test/") else println("No record to read"))
  </code></pre>
  
  <p>Here, even though I see data coming into the stream, my above spark job isn't getting any records. I am sure that I am connecting to right stream with all credentials.
  Please help me out.</p>