コード例 #1
0
 internal TimedBufferingConsumer(IConsumer <T> consumer, TimeSpan waitTime, IThreadingTimer timer)
 {
     _consumer = GaxPreconditions.CheckNotNull(consumer, nameof(consumer));
     _timer    = GaxPreconditions.CheckNotNull(timer, nameof(timer));
     // Initialize the timer to flush ever wait time interval.
     _timer.Initialize((e) => { Flush(); }, waitTime);
 }
コード例 #2
0
 internal TimedBufferingConsumer(IConsumer <T> consumer, TimeSpan waitTime, IThreadingTimer timer)
 {
     _consumer = GaxPreconditions.CheckNotNull(consumer, nameof(consumer));
     _timer    = GaxPreconditions.CheckNotNull(timer, nameof(timer));
     // Initialize the timer to flush ever wait time interval.
     _timer.Initialize((e) => {
         try
         {
             Flush();
         }
         catch (Exception)
         {
             // TODO(talarico): This is a short term solution to ensure
             // we do not kill a process. See issue #2182 to track the long solution.
         }
     }, waitTime);
 }
コード例 #3
0
 internal TimedBufferingConsumer(IConsumer <T> consumer, TimeSpan waitTime, IThreadingTimer timer)
 {
     _consumer = GaxPreconditions.CheckNotNull(consumer, nameof(consumer));
     _timer    = GaxPreconditions.CheckNotNull(timer, nameof(timer));
     // Initialize the timer to flush ever wait time interval.
     _timer.Initialize((e) => {
         try
         {
             Flush();
         }
         catch (RpcException)
         {
             // TODO(talarico): This is a short term solution to ensure
             // we do not kill a process. See issue #842 to track the long term solution.
             // This solution is dependent on implementation details specifically the fact
             // that all consumers that make requests are gRPC based.
         }
     }, waitTime);
 }