private static FabricTransportListenerSettings GetDefaultFabricTransportListenerSettings(string sectionName = "TransportSettings")
        {
            var listenerSettings = (FabricTransportListenerSettings)null;

            if (!FabricTransportListenerSettings.TryLoadFrom(sectionName, out listenerSettings, (string)null))
            {
                listenerSettings = new FabricTransportListenerSettings();
            }
            return(listenerSettings);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Try to load the FabricTransport settings from a section specified in the service settings configuration file - settings.xml
        /// </summary>
        /// <param name="sectionName">Name of the section within the configuration file. if not found , it return false</param>
        /// <param name="configPackageName"> Name of the configuration package. if not found Settings.xml in the configuration package path, it return false.
        /// If not specified, default name is "Config"</param>
        /// <param name="remotingListenerSettings">When this method returns it sets the <see cref="FabricTransportRemotingListenerSettings"/> listenersettings if load from Config succeeded. If fails ,its sets listenerSettings to null/> </param>
        /// <returns> <see cref="bool"/> specifies whether the settings get loaded successfully from Config.
        /// It returns true when load from Config succeeded, else return false.</returns>
        /// <remarks>
        /// The following are the parameter names that should be provided in the configuration file,to be recognizable by service fabric to load the transport settings.
        ///
        ///     1. MaxQueueSize - <see cref="Microsoft.ServiceFabric.Services.Remoting.FabricTransport.FabricTransportRemotingSettings.MaxQueueSize"/>value in long.
        ///     2. MaxMessageSize - <see cref="Microsoft.ServiceFabric.Services.Remoting.FabricTransport.FabricTransportRemotingSettings.MaxMessageSize"/>value in bytes.
        ///     3. MaxConcurrentCalls - <see cref="Microsoft.ServiceFabric.Services.Remoting.FabricTransport.FabricTransportRemotingSettings.MaxConcurrentCalls"/>value in long.
        ///     4. SecurityCredentials - <see cref="Microsoft.ServiceFabric.Services.Remoting.FabricTransport.FabricTransportRemotingSettings.SecurityCredentials"/> value.
        ///     5. OperationTimeoutInSeconds - <see cref="Microsoft.ServiceFabric.Services.Remoting.FabricTransport.FabricTransportRemotingSettings.OperationTimeout"/> value in seconds.
        ///     6. KeepAliveTimeoutInSeconds - <see cref="Microsoft.ServiceFabric.Services.Remoting.FabricTransport.FabricTransportRemotingSettings.KeepAliveTimeout"/> value in seconds.
        /// </remarks>
        public static bool TryLoadFrom(string sectionName,
                                       out FabricTransportRemotingListenerSettings remotingListenerSettings,
                                       string configPackageName = null)
        {
            FabricTransportListenerSettings listenerSettings;
            var isSucceded = FabricTransportListenerSettings.TryLoadFrom(sectionName, out listenerSettings,
                                                                         configPackageName);

            if (isSucceded)
            {
                remotingListenerSettings = new FabricTransportRemotingListenerSettings(listenerSettings);
                return(true);
            }
            remotingListenerSettings = null;
            return(false);
        }