Beispiel #1
0
        Run <TTransportMessage, TDomainMessage>(
            IMessageSource <TTransportMessage> messageSource,
            ITransportToDomainMessageTransform <TTransportMessage, TDomainMessage> messageTransform,
            ServiceProvider rootServiceProvider,
            IIocManagement <TTransportMessage> iocManagement
            )
        {
            Option <TTransportMessage> transportMessageO =
                await messageSource.Poll();

            Option <Either <IPipelineError, Tuple <TTransportMessage, TDomainMessage> > >
            processMessageResult =
                await transportMessageO.MapAsync(
                    transportMessage =>
                    ProcessTransportMessage(
                        messageTransform,
                        rootServiceProvider,
                        iocManagement,
                        transportMessage)).ToOption();

            Either <IPipelineError, Tuple <TTransportMessage, TDomainMessage> >
            resFinal = processMessageResult.Match(
                mpr => mpr,
                () => Prelude.Left <IPipelineError>(new NoTransportMessageAvailable()));

            resFinal.IfRight(m => messageSource.Ack(m.Item1));

            return(resFinal);
        }