Example #1
0
        public async Task SmokeTask()
        {
            var         factory = new RetryingSinkFactory <int>(new TestSinkFactory <int>(), RetryPolicy.NoRetry);
            ISink <int> sink    = await factory.CreateAsync("hub");

            ISinkResult <int> result = await sink.ProcessAsync(1, CancellationToken.None);

            Assert.True(result.IsSuccessful);
            Assert.Equal(new List <int> {
                1
            }, result.Succeeded);
            Assert.False(result.Failed.Any());
            Assert.False(result.InvalidDetailsList.Any());

            await sink.CloseAsync(CancellationToken.None);
        }
Example #2
0
        public async Task RouteAsync(string hubName, IEnumerable <IMessage> messages)
        {
            this.CheckClosed();

            ISinkResult <IMessage> result;

            try
            {
                ISink <IMessage> sink = await this.GetSinkAsync(hubName);

                result = await sink.ProcessAsync(messages.ToArray(), this.cts.Token);
            }
            catch (Exception ex) when(!ex.IsFatal())
            {
                throw;
            }

            // NOTE: we log succeeded however from the caller perspective all are failed (if any) due to next line
            result.SendFailureDetails.ForEach(sfd => throw sfd.RawException);
        }