/// <summary>
        /// 获取数据游标
        /// </summary>
        /// <param name="streamName">通道名称</param>
        /// <param name="shardId">分区ID</param>
        public static GetShardIteratorResult GetCursorDemo(string streamName, string shardId)
        {
            var dic = new DISIngestionClient();

            //该参数与游标类型AT_TIMESTAMP搭配使用
            long timestamp = 1543397197333;

            //该参数与游标类型AT_SEQUENCE_NUMBER、AFTER_SEQUENCE_NUMBER搭配使用
            string startingSequenceNumber = "0";

            //AT_SEQUENCE_NUMBER:从特定序列号所在的记录开始读取。此类型为默认游标类型。
            //AFTER_SEQUENCE_NUMBER:从特定序列号后的记录开始读取。
            //TRIM_HORIZON:从分区中时间最长的记录开始读取。
            //LATEST:在分区中最新的记录之后开始读取,以确保始终读取分区中的最新数据。
            //AT_TIMESTAMP:从特定时间戳开始读取。
            string shardIteratorType = "AT_SEQUENCE_NUMBER";

            var request = new GetShardIteratorRequest
            {
                //通道名称
                StreamName = streamName,
                //分区值
                ShardId = shardId,
                //游标类型,可选参数
                ShardIteratorType = shardIteratorType,
                //序列号,可选参数
                StartingSequenceNumber = startingSequenceNumber,
                //时间戳,可选参数
                Timestamp = timestamp
            };

            var response = dic.GetShardIterator(request);

            Console.Out.WriteLine(response);
            return(response);
        }
        /// <summary>
        /// 下载数据
        /// </summary>
        /// <param name="streamName">通道名称</param>
        /// <param name="shardId">分区ID</param>
        public static void RunConsumerDemo(string streamName, string shardId)
        {
            var dic = new DISIngestionClient();

            //该参数与游标类型AT_TIMESTAMP搭配使用
            long timestamp = 1543397197333;

            //该参数与游标类型AT_SEQUENCE_NUMBER、AFTER_SEQUENCE_NUMBER搭配使用
            const string startingSequenceNumber = "0";

            //AT_SEQUENCE_NUMBER:从特定序列号所在的记录开始读取。此类型为默认游标类型。
            //AFTER_SEQUENCE_NUMBER:从特定序列号后的记录开始读取。
            //TRIM_HORIZON:从分区中时间最长的记录开始读取。
            //LATEST:在分区中最新的记录之后开始读取,以确保始终读取分区中的最新数据。
            //AT_TIMESTAMP:从特定时间戳开始读取。
            const string shardIteratorType = "AT_SEQUENCE_NUMBER";

            var request = new GetShardIteratorRequest
            {
                //通道名称
                StreamName = streamName,
                //分区值
                ShardId = shardId,
                //序列号,可选参数
                StartingSequenceNumber = startingSequenceNumber,
                //游标类型,可选参数
                ShardIteratorType = shardIteratorType,
                //时间戳,可选参数
                Timestamp = timestamp
            };

            var recordsRequest = new GetRecordsRequest();
            var response       = dic.GetShardIterator(request);

            Console.Out.WriteLine(response);

            var iterator = response.ShardIterator;

            //下载数据,这里的进程不会退出,只要检测到有数据就下载数据
            while (true)
            {
                //数据游标。
                recordsRequest.ShardIterator = iterator;
                GetRecordsResult recordResponse = dic.GetRecords(recordsRequest);
                // 下一批数据游标
                iterator = recordResponse.NextShardIterator;

                if (recordResponse.Records.Count > 0)
                {
                    foreach (var record in recordResponse.Records)
                    {
                        Console.WriteLine("Record[{0}] = {1}", record.SequenceNumber, DecodeData(record.Data));
                    }
                    Thread.Sleep(1000);
                }
                else
                {
                    Thread.Sleep(1000);
                }
            }
        }