예제 #1
0
        public void put(KinesisRecord kr)
        {
            var shard_id = kr.Items()[kr.Items().Count - 1].Predicted_shard();

            // Limiter doesn't work if we don't know which shard the record is going to
            if (shard_id == -1)
            {
                callback_(kr);
            }
            else
            {
                GetShardLimiter(shard_id).put(kr, callback_, expired_callback_);
            }
        }
예제 #2
0
 void fail(KinesisRecord kr, DateTime start, DateTime end, string err_code, string err_msg)
 {
     foreach (var ur in kr.Items())
     {
         fail(ur, start, end, err_code, err_msg);
     }
 }
예제 #3
0
 void retry_not_expired(KinesisRecord kr, DateTime start, DateTime end, string err_code, string err_msg)
 {
     foreach (var ur in kr.Items())
     {
         retry_not_expired(ur, start, end, err_code, err_msg);
     }
 }
예제 #4
0
        // We don't want any individual shard to accumulate too much data
        // because that makes traffic to that shard bursty, and might cause
        // throttling, so we flush whenever a shard reaches a certain limit.
        private bool should_flush(KinesisRecord kr)
        {
            var shard_id = kr.Items()[0].Predicted_shard();

            if (shard_id != -1 && buffered_data_.Keys.Contains(shard_id))
            {
                var d = (buffered_data_[shard_id] += kr.accurate_size());
                if (d >= 256 * 1024)
                {
                    return(true);
                }
            }
            return(false);
        }