IReceivePipe IReceivePipeConfiguration.CreatePipe(IConsumePipe consumePipe, IMessageDeserializer messageDeserializer,
                                                          Action <IPipeConfigurator <ReceiveContext> > configure)
        {
            if (_created)
            {
                throw new ConfigurationException("The ReceivePipeConfiguration can only be used once.");
            }

            if (configure == null)
            {
                DeadLetterConfigurator.UseFilter(new DeadLetterTransportFilter());
                _configurator.UseDeadLetter(DeadLetterConfigurator.Build());

                ErrorConfigurator.UseFilter(new GenerateFaultFilter());
                ErrorConfigurator.UseFilter(new ErrorTransportFilter());

                _configurator.UseRescue(ErrorConfigurator.Build(), x =>
                {
                    x.Ignore <OperationCanceledException>();
                });
            }
            else
            {
                configure(_configurator);
            }

            _configurator.UseFilter(new DeserializeFilter(messageDeserializer, consumePipe));

            _created = true;

            return(new ReceivePipe(_configurator.Build(), consumePipe));
        }
Esempio n. 2
0
        IPipe <ReceiveContext> CreateDeadLetterPipe()
        {
            IPipe <ReceiveContext> deadLetterPipe = DeadLetterConfigurator.Build();

            if (deadLetterPipe.IsNotEmpty())
            {
                return(deadLetterPipe);
            }

            DeadLetterConfigurator.UseFilter(new DeadLetterTransportFilter());

            return(DeadLetterConfigurator.Build());
        }