public void Build(RequestSendChannelSchema schema) { SendMessageCache cache = CreateCache(schema); RegisterCacheWithAcknowledgementHandler(cache); BuildPipeline(schema, cache); SendChannelBuiltEvent(schema); }
void BuildPipeline(RequestSendChannelSchema schema, SendMessageCache cache) { MessagePipelineBuilder.Build() .WithBusSendTo(new MessageFilter(schema.FilteringStrategy)) .ToProcessor(new MessageHookRunner<object>(schema.Hooks)) .ToProcessor(new BatchPackager()) .ToConverter(new MessagePayloadPackager(serialiser)) .ToProcessorIf(new CorrelationAssigner(correlationLookup), schema.CorrelateReplyToRequest) .ToProcessor(new MessageHookRunner<MessagePayload>(schema.PostPackagingHooks)) .ToProcessor(new Sequencer(cache)) .ToProcessor(new MessageAddresser(schema.FromAddress, schema.ReceiverAddress)) .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(schema.ReceiverAddress)) .ToEndPoint(messageSender); }
SendMessageCache CreateCache(RequestSendChannelSchema schema) { return messageCacheFactory.BuildSendCache(PersistenceUseType.RequestSend, schema.FromAddress, schema); }
static void SendChannelBuiltEvent(RequestSendChannelSchema schema) { Messenger.Send(new RequestSendChannelBuilt { CacheAddress = schema.FromAddress, SenderAddress = schema.FromAddress, ReceiverAddress = schema.ReceiverAddress }); }