Ejemplo n.º 1
0
        void ConfigureAddDeadLetterFilter(ISendTransportProvider transportProvider)
        {
            IPipe <ReceiveContext> moveToDeadLetterPipe = Pipe.New <ReceiveContext>(x =>
            {
                Func <Task <ISendTransport> > getDeadLetterTransport = () => transportProvider.GetSendTransport(_deadLetterAddress.Value);

                x.UseFilter(new MoveToTransportFilter(_deadLetterAddress.Value, getDeadLetterTransport, "dead-letter"));
            });

            _receiveConfigurator.UseDeadLetterQueue(moveToDeadLetterPipe);
        }
        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));
        }