CreateRemoteAddress() 공개 정적인 메소드

Creates a logical address for a remote endpoint.
public static CreateRemoteAddress ( EndpointInstance endpointInstance ) : LogicalAddress
endpointInstance EndpointInstance The endpoint instance that describes the remote endpoint.
리턴 LogicalAddress
        protected override void Setup(FeatureConfigurationContext context)
        {
            var transportInfrastructure = context.Settings.Get <TransportInfrastructure>();
            var routingEngineConfig     = context.Settings.Get <BlueprintAccessConfiguration>();
            var routingEngine           = routingEngineConfig.Create();

            var outboundRoutingPolicy = context.Settings.Get <TransportInfrastructure>().OutboundRoutingPolicy;

            var evaluator = new BlueprintBasedRouteGenerator(context.Settings.EndpointName());
            var router    = new UnicastRouter(evaluator,
                                              context.Settings.Get <EndpointInstances>(),
                                              context.Settings.Get <DistributionPolicy>(),
                                              instance => transportInfrastructure.ToTransportAddress(LogicalAddress.CreateRemoteAddress(instance)));

            context.RegisterStartupTask(new EngineManagementTask(routingEngine, map => evaluator.UpdateSourceData(map)));

            context.Pipeline.Register(new RouteToSitesBehavior(), "Adds site information to outgoing messages.");

            // if the transport provides native pub/sub support, don't plug in the FileBased pub/sub storage.
            if (outboundRoutingPolicy.Publishes == OutboundRoutingType.Unicast)
            {
                context.Pipeline.Replace("UnicastPublishRouterConnector", new PublishRoutingConnector(router));
                context.Pipeline.Replace("MessageDrivenSubscribeTerminator", new NullSubscribeTerminator(), "handles subscribe operations");
                context.Pipeline.Replace("MessageDrivenUnsubscribeTerminator", new NullUnsubscribeTerminator(), "handles ubsubscribe operations");
            }
            if (outboundRoutingPolicy.Sends == OutboundRoutingType.Unicast)
            {
                context.Pipeline.Replace("UnicastSendRouterConnector", new SendRoutingConnector(router));
            }
            else
            {
                context.Pipeline.Replace("UnicastSendRouterConnector", new MulticastSendRoutingConnector());
            }
        }
예제 #2
0
        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("UnicastSendRouterConnector", b =>
            {
                var router = new UnicastSendRouter(receiveConfiguration == null, receiveConfiguration?.QueueNameBase, receiveConfiguration?.InstanceSpecificQueue, DistributionPolicy, UnicastRoutingTable, EndpointInstances, i => transportInfrastructure.ToTransportAddress(LogicalAddress.CreateRemoteAddress(i)));
                return(new SendConnector(router));
            }, "Determines how the message being sent should be routed");

            pipelineSettings.Register("UnicastReplyRouterConnector", new ReplyConnector(), "Determines how replies should be routed");

            EnforceBestPractices = ShouldEnforceBestPractices(settings);
            if (EnforceBestPractices)
            {
                EnableBestPracticeEnforcement(conventions, pipelineSettings);
            }
        }