public void Initialize(TransportInfrastructure transportInfrastructure, PipelineComponent pipelineComponent, ReceiveConfiguration receiveConfiguration) { var conventions = settings.Get <Conventions>(); var configuredUnicastRoutes = settings.GetOrDefault <ConfiguredUnicastRoutes>(); if (settings.TryGet(out List <DistributionStrategy> distributionStrategies)) { foreach (var distributionStrategy in distributionStrategies) { DistributionPolicy.SetDistributionStrategy(distributionStrategy); } } configuredUnicastRoutes?.Apply(UnicastRoutingTable, conventions); var pipelineSettings = pipelineComponent.PipelineSettings; pipelineSettings.Register(b => { var router = new UnicastSendRouter(receiveConfiguration == null, receiveConfiguration?.QueueNameBase, receiveConfiguration?.InstanceSpecificQueue, DistributionPolicy, UnicastRoutingTable, EndpointInstances, i => transportInfrastructure.ToTransportAddress(LogicalAddress.CreateRemoteAddress(i))); return(new UnicastSendRouterConnector(router)); }, "Determines how the message being sent should be routed"); pipelineSettings.Register(new UnicastReplyRouterConnector(), "Determines how replies should be routed"); EnforceBestPractices = ShouldEnforceBestPractices(settings); if (EnforceBestPractices) { EnableBestPracticeEnforcement(conventions, pipelineSettings); } }
public void Initialize(ReadOnlySettings settings, TransportInfrastructure transportInfrastructure, PipelineSettings pipelineSettings) { var unicastBusConfig = settings.GetConfigSection <UnicastBusConfig>(); var conventions = settings.Get <Conventions>(); var configuredUnicastRoutes = settings.GetOrDefault <ConfiguredUnicastRoutes>(); var distributorAddress = settings.GetOrDefault <string>("LegacyDistributor.Address"); List <DistributionStrategy> distributionStrategies; if (settings.TryGet(out distributionStrategies)) { foreach (var distributionStrategy in distributionStrategies) { DistributionPolicy.SetDistributionStrategy(distributionStrategy); } } unicastBusConfig?.MessageEndpointMappings.Apply(Publishers, UnicastRoutingTable, transportInfrastructure.MakeCanonicalForm, conventions); configuredUnicastRoutes?.Apply(UnicastRoutingTable, conventions); pipelineSettings.Register(b => { var router = new UnicastSendRouter(settings.GetOrDefault <string>("BaseInputQueueName"), settings.EndpointName(), settings.InstanceSpecificQueue(), distributorAddress, DistributionPolicy, UnicastRoutingTable, EndpointInstances, i => transportInfrastructure.ToTransportAddress(LogicalAddress.CreateRemoteAddress(i))); return(new UnicastSendRouterConnector(router)); }, "Determines how the message being sent should be routed"); pipelineSettings.Register(new UnicastReplyRouterConnector(), "Determines how replies should be routed"); EnforceBestPractices = ShouldEnforceBestPractices(settings); if (EnforceBestPractices) { EnableBestPracticeEnforcement(conventions, pipelineSettings); } }
public static RoutingComponent Initialize( Configuration configuration, TransportSeam transportSeam, ReceiveComponent.Configuration receiveConfiguration, Conventions conventions, PipelineSettings pipelineSettings) { var distributionPolicy = configuration.DistributionPolicy; var unicastRoutingTable = configuration.UnicastRoutingTable; var endpointInstances = configuration.EndpointInstances; foreach (var distributionStrategy in configuration.CustomDistributionStrategies) { distributionPolicy.SetDistributionStrategy(distributionStrategy); } configuration.ConfiguredUnicastRoutes?.Apply(unicastRoutingTable, conventions); var isSendOnlyEndpoint = receiveConfiguration.IsSendOnlyEndpoint; if (!isSendOnlyEndpoint) { pipelineSettings.Register( new ApplyReplyToAddressBehavior( receiveConfiguration.LocalAddress, receiveConfiguration.InstanceSpecificQueue, configuration.PublicReturnAddress), "Applies the public reply to address to outgoing messages"); } var sendRouter = new UnicastSendRouter( isSendOnlyEndpoint, receiveConfiguration?.QueueNameBase, receiveConfiguration?.InstanceSpecificQueue, distributionPolicy, unicastRoutingTable, endpointInstances, i => transportSeam.TransportDefinition.ToTransportAddress(new QueueAddress(i.Endpoint, i.Discriminator, i.Properties, null))); if (configuration.EnforceBestPractices) { EnableBestPracticeEnforcement(pipelineSettings, new Validations(conventions)); } return(new RoutingComponent( sendRouter, configuration.EnforceBestPractices)); }
RoutingComponent(UnicastRoutingTable unicastRoutingTable, DistributionPolicy distributionPolicy, EndpointInstances endpointInstances, Publishers publishers, UnicastSendRouter unicastSendRouter, bool enforceBestPractices, Validations messageValidator) { UnicastRoutingTable = unicastRoutingTable; DistributionPolicy = distributionPolicy; EndpointInstances = endpointInstances; Publishers = publishers; EnforceBestPractices = enforceBestPractices; MessageValidator = messageValidator; UnicastSendRouter = unicastSendRouter; }
public static RoutingComponent Initialize(Configuration configuration, TransportComponent.Configuration transportConfiguration, ReceiveConfiguration receiveConfiguration, Conventions conventions, PipelineSettings pipelineSettings) { var distributionPolicy = configuration.DistributionPolicy; var unicastRoutingTable = configuration.UnicastRoutingTable; var endpointInstances = configuration.EndpointInstances; foreach (var distributionStrategy in configuration.DistributionStrategies) { distributionPolicy.SetDistributionStrategy(distributionStrategy); } configuration.ConfiguredUnicastRoutes?.Apply(unicastRoutingTable, conventions); var isSendOnlyEndpoint = receiveConfiguration == null; if (isSendOnlyEndpoint == false) { pipelineSettings.Register(new ApplyReplyToAddressBehavior( receiveConfiguration.LocalAddress, receiveConfiguration.InstanceSpecificQueue, configuration.PublicReturnAddress), "Applies the public reply to address to outgoing messages"); } var sendRouter = new UnicastSendRouter( isSendOnlyEndpoint, receiveConfiguration?.QueueNameBase, receiveConfiguration?.InstanceSpecificQueue, distributionPolicy, unicastRoutingTable, endpointInstances, i => transportConfiguration.ToTransportAddress(LogicalAddress.CreateRemoteAddress(i))); return(new RoutingComponent( unicastRoutingTable, distributionPolicy, endpointInstances, configuration.Publishers, sendRouter, configuration.EnforceBestPractices, new Validations(conventions))); }
public SendConnector(UnicastSendRouter unicastSendRouter) { this.unicastSendRouter = unicastSendRouter; }
RoutingComponent(UnicastSendRouter unicastSendRouter, bool enforceBestPractices) { EnforceBestPractices = enforceBestPractices; UnicastSendRouter = unicastSendRouter; }