public ServiceProxy CreateServiceProxy(ServiceRemotingPartitionClient remotingPartitionClient) { var serviceProxy = (ServiceProxy)this.proxyActivator.CreateInstance(); serviceProxy.Initialize(this, remotingPartitionClient); return(serviceProxy); }
/// <summary> /// Create a proxy to the actor service that is hosting the specified actor id and implementing specified type of the service interface. /// </summary> /// <typeparam name="TServiceInterface">The service interface implemented by the actor service.</typeparam> /// <param name="serviceUri">Uri of the actor service to connect to.</param> /// <param name="partitionKey">The key of the actor service partition to connect to.</param> /// <param name="listenerName"> /// By default an actor service has only one listener for clients to connect to and communicate with. /// However it is possible to configure an actor service with more than one listeners, the listenerName parameter specifies the name of the listener to connect to. /// </param> /// <returns>A service proxy object that implements <see cref="Microsoft.ServiceFabric.Services.Remoting.Client.IServiceProxy"/> and TServiceInterface.</returns> public TServiceInterface CreateActorServiceProxy <TServiceInterface>( Uri serviceUri, long partitionKey, string listenerName = null) where TServiceInterface : IService { var serviceInterfaceType = typeof(TServiceInterface); var proxyGenerator = ServiceCodeBuilder.GetOrCreateProxyGenerator(serviceInterfaceType); var serviceRemotingPartitionClient = new ServiceRemotingPartitionClient( this.GetOrCreateServiceRemotingClientFactory(serviceInterfaceType), serviceUri, new ServicePartitionKey(partitionKey), TargetReplicaSelector.Default, listenerName, this.retrySettings); return((TServiceInterface)(object)proxyGenerator.CreateServiceProxy(serviceRemotingPartitionClient)); }