public IMessageInputter<MessagePayload> Build(RequestRecieveChannelSchema schema, EndpointAddress senderAddress)
        {
            Contract.Requires(schema != null);
            Contract.Requires(senderAddress != null);

            MessageProcessor startPoint = CreateStartPoint();
            BuildChannel(startPoint, schema, CreateCache(schema, senderAddress));
            SendChannelBuiltEvent(schema, senderAddress);

            return startPoint;
        }
        public void Build(RequestRecieveChannelSchema schema)
        {
            Contract.Requires(schema != null);

            var distributor = new RequestRecieveChannelDistributor(SelectChangeStore(schema), builder, schema, checkPointStrategy);
            
            MessagePipelineBuilder.Build()  
                .With(messageReceiver)
                .ToProcessor(new BodyMessageFilter(schema.Address))
                .ToEndPoint(new RequestReceiveSubscriptionHandler(distributor));

            MessagePipelineBuilder.Build()
                .With(messageReceiver)
                .ToProcessor(new BodyMessageFilter(schema.Address))
                .ToEndPoint(distributor);

            distributor.Initialise();
        }
 ChangeStore SelectChangeStore(RequestRecieveChannelSchema schema)
 {
     return changeStoreSelector.SelectChangeStore(schema);
 }
 static void SendChannelBuiltEvent(RequestRecieveChannelSchema schema, EndpointAddress senderAddress)
 {
     Messenger.Send(new RequestReceiveChannelBuilt
     {
         CacheAddress = senderAddress,
         SenderAddress = senderAddress,
         ReceiverAddress = schema.Address
     });
 }
 void BuildChannel(MessageProcessor startPoint, RequestRecieveChannelSchema schema, ReceiveMessageCache messageCache)
 {
     MessagePipelineBuilder.Build()
         .With(startPoint)
         .ToProcessorIf(new NullMessageProcessor(), schema.BlockMessages)
         .ToProcessor(new ReceiverAuthenticationSessionVerifier(authenticationSessionCache, authenticatedServerRegistry))
         .ToProcessor(new SequenceOriginApplier(messageCache))
         .ToProcessor(new MessageSendTimeRemover())
         .ToProcessor(new ReceiveChannelMessageCacher(messageCache))
         .ToProcessor(new MessageAcknowledger(acknowledgementSender))
         .ToSimpleMessageRepeater(messageCache, systemTime, taskRepeater)
         .ToProcessor(new ReceiveChannelMessageCacher(messageCache))
         .Queue()
         .ToResequencerIfSequenced(messageCache, schema)
         .ToProcessor(new ReplyChannelSelector(replyAddressLookup, correlationLookup))
         .ToProcessor(new ExceptionReplier(schema.ContinueOnException))
         .ToProcessor(new MessageHookRunner<MessagePayload>(schema.PreUnpackagingHooks))
         .ToConverter(new MessagePayloadUnpackager(serialiser))
         .ToProcessor(new MessageFilter(schema.FilterStrategy))
         .ToProcessor(schema.UnitOfWorkRunnerCreator())
         .ToProcessor(new BatchUnpackager())
         .ToProcessorIf(new MainThreadMessageMashaller(mainThreadMarshaller), schema.HandleRequestsOnMainThread)
         .ToProcessor(new MessageHookRunner<object>(schema.Hooks))
         .ToEndPoint(messageHandlerRouter);
 }
 ReceiveMessageCache CreateCache(RequestRecieveChannelSchema schema, EndpointAddress senderAddress)
 {
     return messageCacheFactory.BuildReceiveCache(PersistenceUseType.RequestReceive, senderAddress, schema);
 }