Beispiel #1
0
        protected override async Task ProcessAsync(long payload)
        {
            var msg = new Signal()
            {
                Sequence = payload,
                DeviceId = $"Source{payload % 10}",
                Counter1 = payload % 121,
                Counter2 = payload / 2
            };
            await _consumer.ReceiveAsync(msg).ConfigureAwait(false);

            Track.Inc(Counters.SentMessages);
        }
Beispiel #2
0
 protected override async Task ProcessAsync(Signal payload)
 {
     Track.Inc(Counters.ReceivedMessages);
     await Track.Profile(Timers.RequestTimer, async() =>
     {
         while (true)
         {
             try
             {
                 await _persistence.AppendAsync(
                     payload.DeviceId,
                     DateTime.UtcNow.Ticks,
                     payload
                     ).ConfigureAwait(false);
                 return;
             }
             catch (DuplicateStreamIndexException)
             {
                 // retry with new ticks
             }
         }
     }).ConfigureAwait(false);
 }
Beispiel #3
0
 public Task <bool> SimulateMessage(long msgId)
 {
     Track.Inc(Counters.SimulatedMessages);
     return(PushAsync(msgId));
 }