/// <summary>
        /// Creates service remoting client factory.
        /// </summary>
        /// <param name="callbackClient">Callback from the remoting listener to the client.</param>
        /// <returns>Created service remoting client factory as <see cref="IServiceRemotingClientFactory"/></returns>
        protected virtual IServiceRemotingClientFactory CreateServiceRemotingClientFactory(
            IServiceRemotingCallbackClient callbackClient)
        {
            if (this.createServiceRemotingClientFactory != null)
            {
                return(this.createServiceRemotingClientFactory(callbackClient));
            }

            return(null);
        }
예제 #2
0
 /// <summary>
 ///     Creates a service remoting client factory that can be used by the
 ///     <see cref="Microsoft.ServiceFabric.Services.Remoting.Client.ServiceProxyFactory"/>
 ///     to create a proxy for the remoted interface of the service.
 /// </summary>
 /// <param name="callbackClient">
 ///     Client implementation where the callbacks should be dispatched.
 /// </param>
 /// <returns>
 ///     A <see cref="Microsoft.ServiceFabric.Services.Remoting.Wcf.Client.WcfServiceRemotingClientFactory"/>.
 /// </returns>
 public override IServiceRemotingClientFactory CreateServiceRemotingClientFactory(
     IServiceRemotingCallbackClient callbackClient)
 {
     return(new Wcf.Client.WcfServiceRemotingClientFactory(
                WcfUtility.CreateTcpClientBinding(
                    this.GetMaxMessageSize(),
                    this.GetOpenTimeout(),
                    this.GetCloseTimeout()),
                callbackClient));
 }
예제 #3
0
 private static IServiceRemotingCallbackContract GetCallbackImplementation(IServiceRemotingCallbackClient callbackClient)
 {
     if (callbackClient == null)
     {
         return(new NoOpCallbackReceiver());
     }
     else
     {
         return(new CallbackReceiver(callbackClient));
     }
 }
예제 #4
0
        private IServiceRemotingClientFactory CreateServiceRemotingClientFactory(IServiceRemotingCallbackClient serviceRemotingCallbackClient, Type serviceInterfaceType)
        {
            var serviceMethodDispatcher = base.GetOrDiscoverServiceMethodDispatcher(serviceInterfaceType);

            return(FabricTransportServiceRemotingHelpers.CreateServiceRemotingClientFactory(
                       serviceInterfaceType,
                       serviceRemotingCallbackClient,
                       Logger,
                       ServiceRequestContext.Current?[ServiceRequestContextKeys.CorrelationId],
                       serviceMethodDispatcher));
        }
예제 #5
0
        /// <summary>
        ///     Creates a service remoting client factory for connecting to the service over remoted service interfaces.
        /// </summary>
        /// <param name="callbackClient">
        ///     Client implementation where the callbacks should be dispatched.
        /// </param>
        /// <returns>
        ///     A <see cref="Microsoft.ServiceFabric.Services.Remoting.FabricTransport.Client.FabricTransportServiceRemotingClientFactory"/>
        ///     as <see cref="Microsoft.ServiceFabric.Services.Remoting.Client.IServiceRemotingClientFactory"/>
        ///     that can be used with <see cref="Microsoft.ServiceFabric.Services.Remoting.Client.ServiceProxyFactory"/> to
        ///     generate service proxy to talk to a stateless or stateful service over remoted actor interface.
        /// </returns>
        public override IServiceRemotingClientFactory CreateServiceRemotingClientFactory(
            IServiceRemotingCallbackClient callbackClient)
        {
            var settings = FabricTransportRemotingSettings.GetDefault();

            settings.MaxMessageSize   = this.GetAndValidateMaxMessageSize(settings.MaxMessageSize);
            settings.OperationTimeout = this.GetAndValidateOperationTimeout(settings.OperationTimeout);
            settings.KeepAliveTimeout = this.GetKeepAliveTimeout(settings.KeepAliveTimeout);
            settings.ConnectTimeout   = this.GetConnectTimeout(settings.ConnectTimeout);
            return(new FabricTransportServiceRemotingClientFactory(settings, callbackClient));
        }
 public WcfServiceRemotingClientFactory(IServiceRemotingCallbackClient callbackImplementation, Binding clientBinding)
 {
     WcfFactory =
         new WcfCommunicationClientFactory<IServiceRemotingContract>(ServicePartitionResolver.GetDefault(),
             clientBinding, new CallbackReciver(callbackImplementation), new IExceptionHandler[]
             {
                 new FaultExceptionHandler(this)
             });
     WcfFactory.ClientConnected += OnClientConnected;
     WcfFactory.ClientDisconnected += OnClientDisconnected;
 }
        public MyServiceRemotingClientFactory(
            IServiceRemotingCallbackClient callbackClient,
            IServicePartitionResolver resolver = null,
            IEnumerable <IExceptionHandler> exceptionHandlers = null)
        {
            this.innerRemotingClientFactory = new FabricTransportServiceRemotingClientFactory(
                new FabricTransportSettings(),
                callbackClient,
                resolver,
                exceptionHandlers);

            this.innerRemotingClientFactory.ClientConnected    += this.ClientConnected;
            this.innerRemotingClientFactory.ClientDisconnected += this.ClientDisconnected;
        }
 /// <summary>
 ///     Constructs a WCF based actor remoting factory.
 /// </summary>
 /// <param name="clientBinding">
 ///     WCF binding to use for the client. If the client binding is null,
 ///     a default client binding is created using
 ///     <see cref="Microsoft.ServiceFabric.Services.Communication.Wcf.WcfUtility.CreateTcpClientBinding"/> method
 ///     which creates a <see cref="System.ServiceModel.NetTcpBinding"/> with no security.
 /// </param>
 /// <param name="callbackClient">
 ///     The callback client that receives the callbacks from the service.
 /// </param>
 /// <param name="exceptionHandlers">
 ///     Exception handlers to handle the exceptions encountered in communicating with the service.
 /// </param>
 /// <param name="servicePartitionResolver">
 ///     Service partition resolver to resolve the service endpoints. If not specified, a default
 ///     service partition resolver returned by <see cref="ServicePartitionResolver.GetDefault"/> is used.
 /// </param>
 /// <param name="traceId">
 ///     Id to use in diagnostics traces from this component.
 /// </param>
 /// <remarks>
 ///     This factory uses <see cref="Microsoft.ServiceFabric.Services.Communication.Wcf.Client.WcfExceptionHandler"/>,
 ///     <see cref="Microsoft.ServiceFabric.Services.Remoting.Client.ServiceRemotingExceptionHandler"/> and
 ///     <see cref="Microsoft.ServiceFabric.Actors.Remoting.Client.ActorRemotingExceptionHandler"/>, in addition to the
 ///     exception handlers supplied to the constructor.
 /// </remarks>
 public WcfActorRemotingClientFactory(
     Binding clientBinding,
     IServiceRemotingCallbackClient callbackClient,
     IEnumerable <IExceptionHandler> exceptionHandlers  = null,
     IServicePartitionResolver servicePartitionResolver = null,
     string traceId = null) :
     base(
         clientBinding,
         callbackClient,
         GetExceptionHandlers(exceptionHandlers),
         servicePartitionResolver,
         traceId)
 {
 }
예제 #9
0
 /// <summary>
 /// Constructs a fabric transport based actor remoting client factory.
 /// </summary>
 /// <param name="fabricTransportRemotingSettings">
 ///     The settings for the fabric transport. If the settings are not provided or null, default settings
 ///     with no security.
 /// </param>
 /// <param name="callbackClient">
 ///     The callback client that receives the callbacks from the service.
 /// </param>
 /// <param name="servicePartitionResolver">
 ///     Service partition resolver to resolve the service endpoints. If not specified, a default
 ///     service partition resolver returned by <see cref="ServicePartitionResolver.GetDefault"/> is used.
 /// </param>
 /// <param name="exceptionHandlers">
 ///     Exception handlers to handle the exceptions encountered in communicating with the actor.
 /// </param>
 /// <param name="traceId">
 ///     Id to use in diagnostics traces from this component.
 /// </param>
 public FabricTransportActorRemotingClientFactory(
     FabricTransportRemotingSettings fabricTransportRemotingSettings,
     IServiceRemotingCallbackClient callbackClient,
     IServicePartitionResolver servicePartitionResolver = null,
     IEnumerable <IExceptionHandler> exceptionHandlers  = null,
     string traceId = null) :
     base(
         fabricTransportRemotingSettings,
         callbackClient,
         servicePartitionResolver,
         GetExceptionHandlers(exceptionHandlers),
         traceId)
 {
 }
예제 #10
0
        public IServiceRemotingCallbackClient GetCallBackClient()
        {
            if (this.callback == null)
            {
                var nativeCallback = this.requestContext.GetCallbackClient();
                this.callback = new FabricTransportServiceRemotingCallbackClient(nativeCallback, serializersManager);
            }

            if (this.callback == null)
            {
                throw new FabricTransportCallbackNotFoundException(string.Format(CultureInfo.CurrentCulture, SR.ErrorClientCallbackChannelNotFound, this.id));
            }

            return(this.callback);
        }
예제 #11
0
        private IServiceRemotingClientFactory CreateServiceRemotingClientFactory(IServiceRemotingCallbackClient serviceRemotingCallbackClient, Type serviceInterfaceType, Type actorInterfaceType)
        {
            var serviceMethodDispatcher = base.GetOrDiscoverServiceMethodDispatcher(serviceInterfaceType);
            var actorMethodDispatcher   = GetOrDiscoverActorMethodDispatcher(actorInterfaceType);

            var interfaceType = actorInterfaceType ?? serviceInterfaceType;

            return(FabricTransportActorRemotingHelpers.CreateServiceRemotingClientFactory(
                       interfaceType: interfaceType,
                       callbackClient: serviceRemotingCallbackClient,
                       logger: Logger,
                       correlationId: ServiceRequestContext.Current?[ServiceRequestContextKeys.CorrelationId],
                       actorMethodDispatcher: actorMethodDispatcher,
                       serviceMethodDispatcher: serviceMethodDispatcher));
        }
 public FabricTransportServiceRemotingClientFactoryImpl(
     Remoting.FabricTransport.FabricTransportRemotingSettings fabricTransportRemotingSettings = null,
     IServiceRemotingCallbackClient callbackHandler     = null,
     IServicePartitionResolver servicePartitionResolver = null,
     IEnumerable <IExceptionHandler> exceptionHandlers  = null,
     string traceId = null)
     : base(
         servicePartitionResolver,
         GetExceptionHandlers(exceptionHandlers),
         traceId)
 {
     this.settings = fabricTransportRemotingSettings ?? FabricTransportRemotingSettings.GetDefault();
     this.fabricTransportRemotingCallbackMessageHandler =
         new FabricTransportRemotingCallbackMessageHandler(callbackHandler);
 }
예제 #13
0
        /// <summary>
        ///     Constructs a WCF based service remoting client factory.
        /// </summary>
        /// <param name="clientBinding">
        ///     WCF binding to use for the client. If the client binding is not specified or null,
        ///     a default client binding is created using
        ///     <see cref="Microsoft.ServiceFabric.Services.Communication.Wcf.WcfUtility.CreateTcpClientBinding"/> method
        ///     which creates a <see cref="System.ServiceModel.NetTcpBinding"/> with no security.
        /// </param>
        /// <param name="callbackClient">
        ///     The callback client that receives the callbacks from the service.
        /// </param>
        /// <param name="exceptionHandlers">
        ///     Exception handlers to handle the exceptions encountered in communicating with the service.
        /// </param>
        /// <param name="servicePartitionResolver">
        ///     Service partition resolver to resolve the service endpoints. If not specified, a default
        ///     service partition resolver returned by <see cref="ServicePartitionResolver.GetDefault"/> is used.
        /// </param>
        /// <param name="traceId">
        ///     Id to use in diagnostics traces from this component.
        /// </param>
        /// <param name="createWcfClientFactory">
        ///     Delegate function that creates <see cref="Microsoft.ServiceFabric.Services.Communication.Wcf.Client.WcfCommunicationClientFactory{TServiceContract}"/> using the
        ///     <see cref="IServiceRemotingContract"/>.
        /// </param>
        /// <remarks>
        ///     This factory uses <see cref="WcfExceptionHandler"/> and <see cref="ServiceRemotingExceptionHandler"/> in addition to the
        ///     exception handlers supplied to the constructor.
        /// </remarks>
        public WcfServiceRemotingClientFactory(
            Binding clientBinding = null,
            IServiceRemotingCallbackClient callbackClient      = null,
            IEnumerable <IExceptionHandler> exceptionHandlers  = null,
            IServicePartitionResolver servicePartitionResolver = null,
            string traceId = null,
            Func <
                Binding,
                IEnumerable <IExceptionHandler>,
                IServicePartitionResolver,
                string,
                IServiceRemotingCallbackContract,
                WcfCommunicationClientFactory <IServiceRemotingContract> > createWcfClientFactory = null)
        {
            if (traceId == null)
            {
                traceId = Guid.NewGuid().ToString();
            }

            if (createWcfClientFactory == null)
            {
                this.wcfFactory = new WcfCommunicationClientFactory <IServiceRemotingContract>(
                    clientBinding,
                    GetExceptionHandlers(exceptionHandlers, traceId),
                    servicePartitionResolver,
                    traceId,
                    GetCallbackImplementation(callbackClient));
            }
            else
            {
                this.wcfFactory = createWcfClientFactory(
                    clientBinding,
                    GetExceptionHandlers(exceptionHandlers, traceId),
                    servicePartitionResolver,
                    traceId,
                    GetCallbackImplementation(callbackClient));
            }

            this.wcfFactory.ClientConnected    += this.OnClientConnected;
            this.wcfFactory.ClientDisconnected += this.OnClientDisconnected;
        }
        public static IServiceRemotingClientFactory CreateServiceRemotingClientFactory(
            Type serviceInterfaceType,
            IServiceRemotingCallbackClient callbackClient,
            IServiceClientLogger logger,
            string correlationId,
            MethodDispatcherBase serviceMethodDispatcher)
        {
            var fabricTransportSettings = GetDefaultFabricTransportSettings("TransportSettings");
            var exceptionHandlers       = GetExceptionHandlers(serviceInterfaceType);

            return
                ((IServiceRemotingClientFactory) new Client.FabricTransportServiceRemotingClientFactory(
                     new FabricTransportServiceRemotingClientFactory(
                         fabricTransportSettings,
                         callbackClient,
                         (IServicePartitionResolver)null,
                         exceptionHandlers,
                         traceId: correlationId),
                     logger,
                     serviceMethodDispatcher));
        }
        /// <summary>
        ///     Constructs a fabric transport based service remoting client factory.
        /// </summary>
        /// <param name="FabricTransportRemotingSettings">
        ///     The settings for the fabric transport. If the settings are not provided or null, default settings
        ///     with no security.
        /// </param>
        /// <param name="callbackClient">
        ///     The callback client that receives the callbacks from the service.
        /// </param>
        /// <param name="servicePartitionResolver">
        ///     Service partition resolver to resolve the service endpoints. If not specified, a default
        ///     service partition resolver returned by <see cref="ServicePartitionResolver.GetDefault"/> is used.
        /// </param>
        /// <param name="exceptionHandlers">
        ///     Exception handlers to handle the exceptions encountered in communicating with the service.
        /// </param>
        /// <param name="traceId">
        ///     Id to use in diagnostics traces from this component.
        /// </param>
        /// <remarks>
        ///     This factory uses an internal fabric transport exception handler to handle exceptions at the fabric TCP transport
        ///     level and a <see cref="ServiceRemotingExceptionHandler"/>, in addition to the exception handlers supplied to the
        ///     constructor.
        /// </remarks>
        public FabricTransportServiceRemotingClientFactory(
            FabricTransportRemotingSettings FabricTransportRemotingSettings = null,
            IServiceRemotingCallbackClient callbackClient      = null,
            IServicePartitionResolver servicePartitionResolver = null,
            IEnumerable <IExceptionHandler> exceptionHandlers  = null,
            string traceId = null)
        {
            if (traceId == null)
            {
                traceId = Guid.NewGuid().ToString();
            }


            this.impl = new FabricTransportServiceRemotingClientFactoryImpl(
                FabricTransportRemotingSettings,
                callbackClient,
                servicePartitionResolver,
                GetExceptionHandlers(exceptionHandlers, traceId),
                traceId
                );
            this.impl.FabricTransportClientConnected    += this.OnClientConnected;
            this.impl.FabricTransportClientDisconnected += this.OnClientDisconnected;
        }
예제 #16
0
        public static IServiceRemotingClientFactory CreateServiceRemotingClientFactory(Type actorInterfaceType, IServiceRemotingCallbackClient callbackClient, IServiceCommunicationLogger logger, string correlationId)
        {
            var fabricTransportSettings = GetDefaultFabricTransportSettings("TransportSettings");
            var exceptionHandlers       = GetExceptionHandlers(actorInterfaceType);

            return
                ((IServiceRemotingClientFactory) new CodeEffect.ServiceFabric.Actors.Remoting.FabricTransport.Client.FabricTransportActorRemotingClientFactory(
                     new FabricTransportActorRemotingClientFactory(
                         fabricTransportSettings,
                         callbackClient,
                         (IServicePartitionResolver)null,
                         exceptionHandlers,
                         traceId: correlationId), logger));
        }
예제 #17
0
        /// <summary>
        ///     Creates a service remoting client factory to connect to the remoted actor interfaces.
        /// </summary>
        /// <param name="callbackClient">
        ///     Client implementation where the callbacks should be dispatched.
        /// </param>
        /// <returns>
        ///     A <see cref="T:Microsoft.ServiceFabric.Actors.Remoting.FabricTransport.FabricTransportActorRemotingClientFactory" />
        ///     as <see cref="T:Microsoft.ServiceFabric.Services.Remoting.Client.IServiceRemotingClientFactory" />
        ///     that can be used with <see cref="T:Microsoft.ServiceFabric.Actors.Client.ActorProxyFactory" /> to
        ///     generate actor proxy to talk to the actor over remoted actor interface.
        /// </returns>
        public override IServiceRemotingClientFactory CreateServiceRemotingClientFactory(IServiceRemotingCallbackClient callbackClient)
        {
            //Microsoft.ServiceFabric.Services.Remoting.FabricTransport.FabricTransportRemotingSettings
            FabricTransportRemotingSettings fabricTransportSettings = GetDefaultFabricTransportSettings("TransportSettings");

            fabricTransportSettings.MaxMessageSize   = this.GetAndValidateMaxMessageSize(fabricTransportSettings.MaxMessageSize);
            fabricTransportSettings.OperationTimeout = this.GetandValidateOperationTimeout(fabricTransportSettings.OperationTimeout);
            fabricTransportSettings.KeepAliveTimeout = this.GetandValidateKeepAliveTimeout(fabricTransportSettings.KeepAliveTimeout);
            var exceptionHandlers = GetExceptionHandlers();

            return((IServiceRemotingClientFactory) new CodeEffect.ServiceFabric.Actors.Remoting.FabricTransport.Client.FabricTransportActorRemotingClientFactory(
                       new FabricTransportActorRemotingClientFactory(
                           fabricTransportSettings,
                           callbackClient,
                           (IServicePartitionResolver)null,
                           exceptionHandlers,
                           traceId: (string)null), null));
        }
예제 #18
0
 private static IServiceRemotingClientFactory CreateServiceRemotingClientFactory(IServiceRemotingCallbackClient callbackClient)
 {
     return(new CustomFabricTransportServiceRemotingClientFactory(new FabricTransportServiceRemotingClientFactory(callbackClient: callbackClient)));
 }
 public CallbackReciver(IServiceRemotingCallbackClient callbackHandler)
 {
     _callbackHandler = callbackHandler;
 }
예제 #20
0
 /// <summary>
 /// Constructs a fabric transport based actor remoting client factory.
 /// </summary>
 /// <param name="callbackClient">
 ///     The callback client that receives the callbacks from the service.
 /// </param>
 public FabricTransportActorRemotingClientFactory(
     IServiceRemotingCallbackClient callbackClient)
     : this(FabricTransportRemotingSettings.GetDefault(), callbackClient)
 {
 }
 private IServiceRemotingClientFactory CreateServiceRemotingClientFactory(IServiceRemotingCallbackClient serviceRemotingCallbackClient, Type actorInterfaceType)
 {
     return(FabricTransportActorRemotingHelpers.CreateServiceRemotingClientFactory(actorInterfaceType, serviceRemotingCallbackClient, Logger,
                                                                                   ServiceRequestContext.Current.CorrelationId));
 }
 /// <summary>
 ///     Constructs a WCF based actor remoting factory.
 /// </summary>
 /// <param name="callbackClient">
 ///     The callback client that receives the callbacks from the service.
 /// </param>
 public WcfActorRemotingClientFactory(
     IServiceRemotingCallbackClient callbackClient)
     : this(null, callbackClient)
 {
 }
예제 #23
0
 public CallbackReceiver(IServiceRemotingCallbackClient callbackHandler)
 {
     this.callbackHandler = callbackHandler;
 }
        public static TInterface CreateActor <TInterface>(ActorId actorId, Uri serviceUri, string thumbprint, string remoteThumbprint, string remoteCommonName, string applicationName = null, string serviceName = null, string listenerName = null, IServiceRemotingCallbackClient callbackClient = default(IServiceRemotingCallbackClient))
            where TInterface : Microsoft.ServiceFabric.Actors.IActor
        {
            return(new ActorProxyFactory(c => new FabricTransportActorRemotingClientFactory(new FabricTransportRemotingSettings()
#if SECURE_ACTORS
            {
                SecurityCredentials = GetSecurityCredentials(thumbprint, new[] { remoteThumbprint }, new[] { remoteCommonName })
            }
#endif
                                                                                            , callbackClient ?? new DefaultServiceRemotingCallbackClient()))
                   .CreateActorProxy <TInterface>(actorId, applicationName, serviceName, listenerName));
        }
 public static TInterface CreateActor <TInterface>(ActorId actorId, Uri serviceUri, string applicationName = null, string serviceName = null, string listenerName = null, IServiceRemotingCallbackClient callbackClient = default(IServiceRemotingCallbackClient))
     where TInterface : Microsoft.ServiceFabric.Actors.IActor
 {
     return(CreateActor <TInterface>(actorId, serviceUri, Certificates.ServiceThumbprint,
                                     Certificates.ServiceThumbprint, Certificates.ServiceCommonName, applicationName, serviceName,
                                     listenerName, callbackClient));
 }
        public override IServiceRemotingClientFactory CreateServiceRemotingClientFactory(IServiceRemotingCallbackClient callbackClient)
        {
            FabricTransportServiceRemotingClientFactory factory = new FabricTransportServiceRemotingClientFactory(callbackClient: callbackClient);

            return(new CustomFabricTransportServiceRemotingClientFactory(factory));
        }
 public FabricTransportRemotingCallbackMessageHandler(IServiceRemotingCallbackClient remotingCallbackClient)
 {
     this.remotingCallbackClient = remotingCallbackClient;
     this.serializer             = new DataContractSerializer(typeof(ServiceRemotingMessageHeaders));
 }
예제 #28
0
        /// <summary>
        ///     Creates a service remoting client factory to connect to the remoted actor interfaces.
        /// </summary>
        /// <param name="callbackClient">
        ///     Client implementation where the callbacks should be dispatched.
        /// </param>
        /// <returns>
        ///     A <see cref="T:Microsoft.ServiceFabric.Actors.Remoting.FabricTransport.FabricTransportActorRemotingClientFactory" />
        ///     as <see cref="T:Microsoft.ServiceFabric.Services.Remoting.Client.IServiceRemotingClientFactory" />
        ///     that can be used with <see cref="T:Microsoft.ServiceFabric.Actors.Client.ActorProxyFactory" /> to
        ///     generate actor proxy to talk to the actor over remoted actor interface.
        /// </returns>
        public override IServiceRemotingClientFactory CreateServiceRemotingClientFactory(IServiceRemotingCallbackClient callbackClient)
        {
            FabricTransportSettings fabricTransportSettings = GetDefaultFabricTransportSettings("TransportSettings");

            fabricTransportSettings.MaxMessageSize   = this.GetAndValidateMaxMessageSize(fabricTransportSettings.MaxMessageSize);
            fabricTransportSettings.OperationTimeout = this.GetandValidateOperationTimeout(fabricTransportSettings.OperationTimeout);
            fabricTransportSettings.KeepAliveTimeout = this.GetandValidateKeepAliveTimeout(fabricTransportSettings.KeepAliveTimeout);
            var exceptionHandlers = new IExceptionHandler[] { new ActorExceptionHandler() };

            return((IServiceRemotingClientFactory) new FabricTransportActorRemotingClientFactory(fabricTransportSettings, callbackClient, (IServicePartitionResolver)null, exceptionHandlers, (string)null));
        }
        /// <summary>
        ///     Creates a service remoting client factory for connecting to the service over remoted service interfaces.
        /// </summary>
        /// <param name="callbackClient">
        ///     Client implementation where the callbacks should be dispatched.
        /// </param>
        /// <returns>
        ///     A <see cref="T:Microsoft.ServiceFabric.Services.Remoting.FabricTransport.Client.FabricTransportServiceRemotingClientFactory" />
        ///     as <see cref="T:Microsoft.ServiceFabric.Services.Remoting.Client.IServiceRemotingClientFactory" />
        ///     that can be used with <see cref="T:Microsoft.ServiceFabric.Services.Remoting.Client.ServiceProxyFactory" /> to
        ///     generate service proxy to talk to a stateless or stateful service over remoted actor interface.
        /// </returns>
        public override IServiceRemotingClientFactory CreateServiceRemotingClientFactory(IServiceRemotingCallbackClient callbackClient)
        {
            var fabricTransportSettings = GetDefaultFabricTransportSettings();

            fabricTransportSettings.MaxMessageSize   = this.GetAndValidateMaxMessageSize(fabricTransportSettings.MaxMessageSize);
            fabricTransportSettings.OperationTimeout = this.GetAndValidateOperationTimeout(fabricTransportSettings.OperationTimeout);
            fabricTransportSettings.KeepAliveTimeout = this.GetKeepAliveTimeout(fabricTransportSettings.KeepAliveTimeout);
            var exceptionHandlers = ExceptionHandlerTypes?
                                    .Where(exceptionHandlerType => exceptionHandlerType.GetInterface(nameof(IExceptionHandler), false) != null)
                                    .Select(exceptionHandlerType => (IExceptionHandler)Activator.CreateInstance(exceptionHandlerType)).ToArray();

            return((IServiceRemotingClientFactory) new FabricTransportServiceRemotingClientFactory(
                       FabricTransportRemotingSettings: fabricTransportSettings,
                       callbackClient: callbackClient,
                       servicePartitionResolver: (IServicePartitionResolver)null,
                       exceptionHandlers: exceptionHandlers,
                       traceId: (string)null));
        }
 public ActorEventSubscriberProxy(Guid id, IServiceRemotingCallbackClient callback)
 {
     this.id       = id;
     this.callback = callback;
 }
예제 #31
0
 /// <summary>
 ///     Creates a service remoting client factory to connected to the remoted actor interfaces.
 /// </summary>
 /// <param name="callbackClient">
 ///     Client implementation where the callbacks should be dispatched.
 /// </param>
 /// <returns>
 ///     An <see cref="IServiceRemotingClientFactory"/>
 ///     that can be used with <see cref="Microsoft.ServiceFabric.Actors.Client.ActorProxyFactory"/> to
 ///     generate actor proxy to talk to the actor over remoted actor interface.
 /// </returns>
 public abstract IServiceRemotingClientFactory CreateServiceRemotingClientFactory(
     IServiceRemotingCallbackClient callbackClient);
        protected override IServiceRemotingClientFactory CreateServiceRemotingClientFactory(IServiceRemotingCallbackClient callbackClient)
        {
            var factory = base.CreateServiceRemotingClientFactory(callbackClient);


            return(factory);
        }