Exemple #1
0
 /// <summary>
 ///     Constructs a fabric transport based service remoting listener with default
 ///     <see cref="FabricTransportRemotingListenerSettings"/>.
 /// </summary>
 /// <param name="serviceContext">
 ///     The context of the service for which the remoting listener is being constructed.
 /// </param>
 /// <param name="serviceImplementation">
 ///     The service implementation object used to construct <see cref="ServiceRemotingDispatcher"/>
 ///     for message processing.
 /// </param>
 public FabricTransportServiceRemotingListener(
     ServiceContext serviceContext,
     IService serviceImplementation)
     : this(
         serviceContext,
         serviceImplementation,
         listenerSettings : FabricTransportRemotingListenerSettings.GetDefault())
 {
 }
Exemple #2
0
 /// <summary>
 ///     Constructs a fabric transport based service remoting listener with the specified
 ///     <see cref="FabricTransportRemotingListenerSettings"/>.
 /// </summary>
 /// <param name="serviceContext">
 ///     The context of the service for which the remoting listener is being constructed.
 /// </param>
 /// <param name="serviceImplementation">
 ///     The service implementation object used to construct <see cref="ServiceRemotingDispatcher"/>
 ///     for message processing.
 /// </param>
 /// <param name="listenerSettings">
 ///     The settings for the listener.
 /// </param>
 public FabricTransportServiceRemotingListener(
     ServiceContext serviceContext,
     IService serviceImplementation,
     FabricTransportRemotingListenerSettings listenerSettings)
     : this(
         serviceContext,
         new ServiceRemotingDispatcher(serviceContext, serviceImplementation),
         listenerSettings)
 {
 }
Exemple #3
0
 /// <summary>
 ///     Constructs a fabric transport based service remoting listener with <see cref="FabricTransportRemotingListenerSettings"/>
 ///     loaded from configuration section.
 /// </summary>
 /// <param name="serviceContext">
 ///     The context of the service for which the remoting listener is being constructed.
 /// </param>
 /// <param name="serviceImplementation">
 ///     The service implementation object used to construct <see cref="ServiceRemotingDispatcher"/>
 ///     for message processing.
 /// </param>
 /// <param name="listenerSettingsConfigSectionName">
 ///    The name of the configuration section in the configuration package named
 ///    "Config" in the service manifest that defines the settings for the listener.
 /// </param>
 public FabricTransportServiceRemotingListener(
     ServiceContext serviceContext,
     IService serviceImplementation,
     string listenerSettingsConfigSectionName)
     : this(
         serviceContext,
         new ServiceRemotingDispatcher(serviceContext, serviceImplementation),
         FabricTransportRemotingListenerSettings.LoadFrom(listenerSettingsConfigSectionName))
 {
 }
Exemple #4
0
 /// <summary>
 ///     Constructs a fabric transport based service remoting listener with <see cref="FabricTransportRemotingListenerSettings"/>
 ///     loaded from configuration section.
 /// </summary>
 /// <param name="serviceContext">
 ///     The context of the service for which the remoting listener is being constructed.
 /// </param>
 /// <param name="messageHandler">
 ///     The handler for processing remoting messages. As the messages are received,
 ///     the listener delivers them to this handler.
 /// </param>
 /// <param name="listenerSettingsConfigSectionName">
 ///    The name of the configuration section in the configuration package named
 ///    "Config" in the service manifest that defines the settings for the listener.
 /// </param>
 public FabricTransportServiceRemotingListener(
     ServiceContext serviceContext,
     IServiceRemotingMessageHandler messageHandler,
     string listenerSettingsConfigSectionName)
     : this(
         serviceContext,
         messageHandler,
         FabricTransportRemotingListenerSettings.LoadFrom(listenerSettingsConfigSectionName))
 {
 }
 /// <summary>
 ///     Constructs a fabric transport based service remoting listener.
 /// </summary>
 /// <param name="serviceContext">
 ///     The context of the service for which the remoting listener is being constructed.
 /// </param>
 /// <param name="messageHandler">
 ///     The handler for processing remoting messages. As the messages are received,
 ///     the listener delivers them to this handler.
 /// </param>
 /// <param name="listenerSettings">
 ///     The settings to use for the listener.
 /// </param>
 public FabricTransportServiceRemotingListener(
     ServiceContext serviceContext,
     IServiceRemotingMessageHandler messageHandler,
     FabricTransportRemotingListenerSettings listenerSettings)
 {
     this.nativeListener = this.CreateNativeListener(
         listenerSettings,
         messageHandler,
         serviceContext);
 }
Exemple #6
0
        private FabricTransportListener CreateNativeListener(
            FabricTransportRemotingListenerSettings listenerSettings,
            IServiceRemotingMessageHandler messageHandler,
            ServiceContext serviceContext)
        {
            var connectionHandler = new FabricTransportServiceRemotingConnectionHandler();

            return(new FabricTransportListener(
                       listenerSettings.GetInternalSettings(),
                       listenerSettings.GetInternalSettings().GetListenerAddress(serviceContext),
                       new FabricTransportMessagingHandler(messageHandler),
                       connectionHandler));
        }
Exemple #7
0
 /// <summary>
 ///     Constructs a fabric transport based service remoting listener with the specified
 ///     <see cref="FabricTransportRemotingListenerSettings"/>.
 /// </summary>
 /// <param name="serviceContext">
 ///     The context of the service for which the remoting listener is being constructed.
 /// </param>
 /// <param name="messageHandler">
 ///     The handler for processing remoting messages. As the messages are received,
 ///     the listener delivers them to this handler.
 /// </param>
 /// <param name="listenerSettings">
 ///     The settings to use for the listener.
 /// </param>
 public FabricTransportServiceRemotingListener(
     ServiceContext serviceContext,
     IServiceRemotingMessageHandler messageHandler,
     FabricTransportRemotingListenerSettings listenerSettings)
 {
     this.messageHandler = messageHandler;
     this.nativeListener = this.CreateNativeListener(
         listenerSettings,
         this.messageHandler,
         serviceContext);
     this.listenAddress  = serviceContext.ListenAddress;
     this.publishAddress = serviceContext.PublishAddress;
 }
Exemple #8
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);
        }
        /// <summary>
        /// FabricTransportRemotingListenerSettings returns the default Settings .Loads the configuration file from default Config Package"Config" .
        ///</summary>
        /// <param name="sectionName">Name of the section within the configuration file. If not found section in configuration file, it will return the default Settings</param>
        /// <returns></returns>
        internal static FabricTransportRemotingListenerSettings GetDefault(
            string sectionName = FabricTransportSettings.DefaultSectionName)
        {
            var listenerinternalSettings = FabricTransportListenerSettings.GetDefault(sectionName);

            var settings = new FabricTransportRemotingListenerSettings(listenerinternalSettings);

            AppTrace.TraceSource.WriteInfo(
                Tracetype,
                "MaxMessageSize: {0} , MaxConcurrentCalls: {1} , MaxQueueSize: {2} , OperationTimeoutInSeconds: {3} KeepAliveTimeoutInSeconds : {4} , SecurityCredentials {5} , HeaderBufferSize {6}," +
                "HeaderBufferCount {7} ",
                settings.MaxMessageSize,
                settings.MaxConcurrentCalls,
                settings.MaxQueueSize,
                settings.OperationTimeout.TotalSeconds,
                settings.KeepAliveTimeout.TotalSeconds,
                settings.SecurityCredentials.CredentialType,
                settings.HeaderBufferSize,
                settings.HeaderMaxBufferCount);


            return(settings);
        }
Exemple #10
0
 /// <summary>
 ///     Constructs a fabric transport based service remoting listener with default
 ///     <see cref="FabricTransportRemotingListenerSettings"/>.
 /// </summary>
 /// <param name="serviceContext">
 ///     The context of the service for which the remoting listener is being constructed.
 /// </param>
 /// <param name="messageHandler">
 ///     The handler for processing remoting messages. As the messages are received,
 ///     the listener delivers them to this handler.
 /// </param>
 public FabricTransportServiceRemotingListener(
     ServiceContext serviceContext,
     IServiceRemotingMessageHandler messageHandler)
     : this(serviceContext, messageHandler, FabricTransportRemotingListenerSettings.GetDefault())
 {
 }