Exemplo n.º 1
0
        private async Task <bool> Step(ProcessingContext context)
        {
            var fetched = default(IFetchedMessage);

            using (var scopedContext = context.CreateScope())
            {
                var provider   = scopedContext.Provider;
                var connection = provider.GetRequiredService <IStorageConnection>();

                if ((fetched = await connection.FetchNextMessageAsync()) != null)
                {
                    using (fetched)
                    {
                        var queueExecutor = _queueExecutorFactory.GetInstance(fetched.MessageType);
                        await queueExecutor.ExecuteAsync(connection, fetched);
                    }
                }
            }
            return(fetched != null);
        }