/// <summary>
        /// This is used by Kvs and Volatile actor state provider.
        /// </summary>
        /// <param name="codePackage"></param>
        /// <param name="actorImplType"></param>
        /// <returns></returns>
        internal static ReplicatorSettings GetActorReplicatorSettings(CodePackageActivationContext codePackage, Type actorImplType)
        {
            var settings = ReplicatorSettings.LoadFrom(
                codePackage,
                ActorNameFormat.GetConfigPackageName(actorImplType),
                ActorNameFormat.GetFabricServiceReplicatorConfigSectionName(actorImplType));

            settings.SecurityCredentials = SecurityCredentials.LoadFrom(
                codePackage,
                ActorNameFormat.GetConfigPackageName(actorImplType),
                ActorNameFormat.GetFabricServiceReplicatorSecurityConfigSectionName(actorImplType));

            var nodeContext = FabricRuntime.GetNodeContext();
            var endpoint    = codePackage.GetEndpoint(ActorNameFormat.GetFabricServiceReplicatorEndpointName(actorImplType));

            settings.ReplicatorAddress = string.Format(
                CultureInfo.InvariantCulture,
                "{0}:{1}",
                nodeContext.IPAddressOrFQDN,
                endpoint.Port);

            if (!settings.MaxPrimaryReplicationQueueSize.HasValue)
            {
                settings.MaxPrimaryReplicationQueueSize = DefaultMaxPrimaryReplicationQueueSize;
            }

            if (!settings.MaxSecondaryReplicationQueueSize.HasValue)
            {
                settings.MaxSecondaryReplicationQueueSize = DefaultMaxSecondaryReplicationQueueSize;
            }

            return(settings);
        }
コード例 #2
0
        private static void WritePluginRegistrationFile(
            CodePackageActivationContext cpac,
            string dockerDirectory,
            string endpointName)
        {
            var pluginRegistrationDirectory = Path.Combine(dockerDirectory, PluginDirectoryName);

            Utilities.EnsureFolder(pluginRegistrationDirectory);

            var listenAddress = cpac.ServiceListenAddress;
            var endpointPort  = cpac.GetEndpoint(endpointName).Port.ToString();

            var pluginRegistrationFilePath = Path.Combine(pluginRegistrationDirectory, PluginRegistrationFileName);

            File.WriteAllText(
                pluginRegistrationFilePath,
                String.Format(PluginRegistrationFileTemplate, listenAddress, endpointPort));
        }