internal object CreateActorProxy( Type actorInterfaceType, Uri serviceUri, ActorId actorId, string listenerName = null) { var proxyGenerator = ActorCodeBuilder.GetOrCreateProxyGenerator(actorInterfaceType); var factory = this.GetOrCreateServiceRemotingClientFactory(actorInterfaceType); var actorServicePartitionClient = new ActorServicePartitionClient( factory, serviceUri, actorId, listenerName, this.retrySettings); return(proxyGenerator.CreateActorProxy(actorServicePartitionClient, factory.GetRemotingMessageBodyFactory())); }
/// <summary> /// Creates a proxy to the actor object that implements an actor interface. /// </summary> /// <typeparam name="TActorInterface"> /// The actor interface implemented by the remote actor object. /// The returned proxy object will implement this interface. /// </typeparam> /// <param name="serviceUri">Uri of the actor service.</param> /// <param name="actorId">Actor Id of the proxy actor object. Methods called on this proxy will result in requests /// being sent to the actor with this id.</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>An actor proxy object that implements <see cref="IActorProxy"/> and TActorInterface.</returns> public TActorInterface CreateActorProxy <TActorInterface>(Uri serviceUri, ActorId actorId, string listenerName = null) where TActorInterface : IActor { var actorInterfaceType = typeof(TActorInterface); var factory = this.GetOrCreateServiceRemotingClientFactory(actorInterfaceType); var proxyGenerator = ActorCodeBuilder.GetOrCreateProxyGenerator(actorInterfaceType); var actorServicePartitionClient = new ActorServicePartitionClient( factory, serviceUri, actorId, listenerName, this.retrySettings); return((TActorInterface)(object)proxyGenerator.CreateActorProxy(actorServicePartitionClient, factory.GetRemotingMessageBodyFactory())); }