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));
        }
Beispiel #2
0
        void ConfigureRescueFilter(IPublishEndpointProvider publishEndpoint, ISendTransportProvider transportProvider)
        {
            IPipe <ExceptionReceiveContext> moveToErrorPipe = Pipe.New <ExceptionReceiveContext>(x =>
            {
                Func <Task <ISendTransport> > getErrorTransport = () => transportProvider.GetSendTransport(_errorAddress.Value);

                x.UseFilter(new MoveExceptionToTransportFilter(publishEndpoint, _errorAddress.Value, getErrorTransport));
            });

            _receiveConfigurator.UseRescue(moveToErrorPipe);
        }
        void AddRescueFilter(IReceiveEndpointBuilder builder)
        {
            IPipe <ExceptionReceiveContext> moveToErrorPipe = Pipe.New <ExceptionReceiveContext>(x =>
            {
                Func <Task <ISendTransport> > getErrorTransport = () => builder.SendTransportProvider.GetSendTransport(_errorAddress.Value);

                var publishEndpointProvider = builder.CreatePublishEndpointProvider(InputAddress, _publishPipeConfigurator);

                x.UseFilter(new MoveExceptionToTransportFilter(publishEndpointProvider, _errorAddress.Value, getErrorTransport));
            });

            _receiveConfigurator.UseRescue(moveToErrorPipe);
        }
        void ConfigureRescueFilter(ISendTransportProvider transportProvider)
        {
            IPipe <ExceptionReceiveContext> moveToErrorPipe = Pipe.New <ExceptionReceiveContext>(x =>
            {
                Uri errorAddress = GetErrorAddress();

                Func <Task <ISendTransport> > getErrorTransport = () => transportProvider.GetSendTransport(errorAddress);

                x.UseFilter(new MoveExceptionToTransportFilter(errorAddress, getErrorTransport));
            });

            _receiveConfigurator.UseRescue(moveToErrorPipe);
        }
        protected IReceivePipe CreateReceivePipe(IReceiveEndpointBuilder builder)
        {
            foreach (var specification in _specifications)
            {
                specification.Configure(builder);
            }

            _receiveConfigurator.UseDeadLetterQueue(Pipe.New <ReceiveContext>(x => x.UseFilter(new MoveToTransportFilter(DeadLetterAddress, "dead-letter"))));
            _receiveConfigurator.UseRescue(Pipe.New <ExceptionReceiveContext>(x => x.UseFilter(new MoveExceptionToTransportFilter(ErrorAddress))));
            _receiveConfigurator.UseFilter(new DeserializeFilter(builder.MessageDeserializer, builder.ConsumePipe));

            IPipe <ReceiveContext> receivePipe = _receiveConfigurator.Build();

            return(new ReceivePipe(receivePipe, builder.ConsumePipe));
        }
Beispiel #6
0
        public IReceivePipe CreatePipe(IConsumePipe consumePipe, IMessageDeserializer messageDeserializer)
        {
            if (_created)
            {
                throw new ConfigurationException("The ReceivePipeConfiguration can only be used once.");
            }

            _configurator.UseDeadLetter(CreateDeadLetterPipe());
            _configurator.UseRescue(CreateErrorPipe(), x =>
            {
                x.Ignore <OperationCanceledException>();
            });

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

            _created = true;

            return(new ReceivePipe(_configurator.Build(), consumePipe));
        }
        public IReceivePipe CreatePipe(IConsumePipe consumePipe, IMessageDeserializer messageDeserializer)
        {
            if (_created)
            {
                throw new ConfigurationException("The ReceivePipeConfiguration can only be used once.");
            }

            _deadLetterPipeConfigurator.UseFilter(new DeadLetterTransportFilter());
            _configurator.UseDeadLetter(_deadLetterPipeConfigurator.Build());

            _errorPipeConfigurator.UseFilter(new GenerateFaultFilter());
            _errorPipeConfigurator.UseFilter(new ErrorTransportFilter());
            _configurator.UseRescue(_errorPipeConfigurator.Build());

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

            _created = true;

            return(new ReceivePipe(_configurator.Build(), consumePipe));
        }