public IMessageInputter<object> Build(ReplySendChannelSchema schema, EndpointAddress senderAddress) { SendMessageCache cache = CreateCache(schema, senderAddress); RegisterCacheWithAcknowledgementHandler(cache); IMessageProcessor<object, object> startPoint = CreateStartPoint(); BuildPipeline(startPoint, schema, senderAddress, cache); SendChannelBuiltEvent(schema, senderAddress); return startPoint; }
public void Build(ReplySendChannelSchema schema) { Contract.Requires(schema != null); var distributor = new ReplySendChannelDistributor( changeStoreSelector.SelectChangeStore(schema), replyAddressLookup, builder, schema, checkPointStrategy); MessagePipelineBuilder.Build() .With(messageReceiver) .ToProcessor(new BodyMessageFilter(schema.FromAddress)) .ToEndPoint(new ReplySendSubscriptionHandler(distributor)); MessagePipelineBuilder.Build() .WithBusReplyTo(CreateReplyChannelMessageFilter(schema)) .ToEndPoint(distributor); distributor.Initialise(); }
ReplyChannelMessageFilterStategy CreateReplyChannelMessageFilterStategy(ReplySendChannelSchema schema) { return new ReplyChannelMessageFilterStategy(replyAddressLookup, schema.FromAddress); }
MessageFilter CreateReplyChannelMessageFilter(ReplySendChannelSchema schema) { return new MessageFilter(CreateReplyChannelMessageFilterStategy(schema)); }
void BuildPipeline(IMessageProcessor<object, object> startPoint, ReplySendChannelSchema schema, EndpointAddress senderAddress, SendMessageCache cache) { MessagePipelineBuilder.Build() .With(startPoint) .ToProcessor(new MessageHookRunner<object>(schema.Hooks)) .ToProcessor(new BatchPackager()) .ToConverter(new MessagePayloadPackager(serialiser)) .ToProcessor(new ReplyCorrelationApplier(correlationLookup)) .ToProcessor(new Sequencer(cache)) .ToProcessor(new MessageAddresser(schema.FromAddress, senderAddress)) .ToProcessor(new SendChannelMessageCacher(cache)) .ToMessageRepeater(cache, systemTime, taskRepeater, schema.RepeatStrategy) .ToProcessor(new SendChannelMessageCacheUpdater(cache)) .ToProcessor(new SequenceOriginRecorder(cache)) .ToProcessor(new PersistenceSourceRecorder()) .Queue() .ToProcessor(new MessageExpirer(schema.ExpiryAction, cache, schema.ExpiryStrategy)) .ToProcessor(new LoadBalancer(cache, taskScheduler)) .ToProcessor(new LastSentRecorder(systemTime)) .ToProcessor(authenticationSessionAttacherFactory.Create()) .ToEndPoint(messageSender); }
SendMessageCache CreateCache(ReplySendChannelSchema schema, EndpointAddress senderAddress) { return messageCacheFactory.BuildSendCache(PersistenceUseType.ReplySend, senderAddress, schema); }
static void SendChannelBuiltEvent(ReplySendChannelSchema schema, EndpointAddress senderAddress) { Messenger.Send(new ReplySendChannelBuilt { CacheAddress = senderAddress, ReceiverAddress = schema.FromAddress, SenderAddress = senderAddress }); }