ActorProxyBase Class

  • java.lang.Object
    • ProxyBase
      • microsoft.servicefabric.actors.client.ActorProxyBase

public class ActorProxyBase extends ProxyBase implements ActorProxy

Provides the base implementation for the proxy to the remote actor objects implementing IActor interfaces.

Constructor Summary

Constructor Description
ActorProxyBase()

Initializes a new instance of the ActorProxy class.

Method Summary

Modifier and Type Method and Description
static<T extends Actor> T create(Class<T> actorInterfaceType, ActorId actorId)

Creates a proxy to the actor object that implements an actor interface.

The applicationName parameter can be null if the client is running as part of the same Service Fabric application as the actor service it intends to communicate with. In this case, the application name is determined from CodePackageActivationContext, and is obtained by calling the getApplicationName() property.

static<T extends Actor> T create(Class<T> actorInterfaceType, ActorId actorId, String applicationName)

Creates a proxy to the actor object that implements an actor interface.

The applicationName parameter can be null if the client is running as part of the same Service Fabric application as the actor service it intends to communicate with. In this case, the application name is determined from CodePackageActivationContext, and is obtained by calling the getApplicationName() property.

static<T extends Actor> T create(Class<T> actorInterfaceType, ActorId actorId, String applicationName, String serviceName)

Creates a proxy to the actor object that implements an actor interface.

The applicationName parameter can be null if the client is running as part of the same Service Fabric application as the actor service it intends to communicate with. In this case, the application name is determined from CodePackageActivationContext, and is obtained by calling the getApplicationName() property.

static<T extends Actor> T create(Class<T> actorInterfaceType, ActorId actorId, String applicationName, String serviceName, String listenerName)

Creates a proxy to the actor object that implements an actor interface.

The applicationName parameter can be null if the client is running as part of the same Service Fabric application as the actor service it intends to communicate with. In this case, the application name is determined from CodePackageActivationContext, and is obtained by calling the getApplicationName() property.

static<T extends Actor> T create(Class<T> actorInterfaceType, ActorId actorId, URI serviceUri)

Creates a proxy to the actor object that implements an actor interface.

static<T extends Actor> T create(Class<T> actorInterfaceType, ActorId actorId, URI serviceUri, String listenerName)

Creates a proxy to the actor object that implements an actor interface.

Object createRequestMessageBody(Object requestMessageBodyValue)
Object deserializeMessage(byte[] msgBodyValue)
ActorId getActorId()

Gets ActorId associated with the proxy object.

ActorServicePartitionClientImpl getActorServicePartitionClient()

Gets microsoft.servicefabric.actors.remoting.client.internal.ActorServicePartitionClientImpl that this proxy is using to communicate with the actor.

FabricActorProxyFactory getDefaultProxyFactory()

Gets the default actor proxy factory.

Object getResponseMessageBodyValue(Object responseMessageBody)
void initialize(ActorServicePartitionClientImpl actorServicePartitionClient)

Method to initialize the actor proxy instance For internal use only.

void invoke(int interfaceId, int methodId, byte[] requestMsgBodyBytes)
CompletableFuture<byte[]> invokeAsync(int interfaceId, int methodId, byte[] requestMsgBodyBytes, CancellationToken cancellationToken)
byte [] serializeMessage(Object msgBodyValue)

Inherited Members

Constructor Details

ActorProxyBase

protected ActorProxyBase()

Initializes a new instance of the ActorProxy class.

Method Details

create

public static static T create(Class actorInterfaceType, ActorId actorId)

Creates a proxy to the actor object that implements an actor interface.

The applicationName parameter can be null if the client is running as part of the same Service Fabric application as the actor service it intends to communicate with. In this case, the application name is determined from CodePackageActivationContext, and is obtained by calling the getApplicationName() property.

Parameters:

actorInterfaceType - The actor interface implemented by the remote actor object. The returned proxy object will implement this interface.
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.

Returns:

An actor proxy object that implements ActorProxy and TActorInterface.

Throws:

URISyntaxException - Throws exception when invalid URI format is passed as applicationName

create

public static static T create(Class actorInterfaceType, ActorId actorId, String applicationName)

Creates a proxy to the actor object that implements an actor interface.

The applicationName parameter can be null if the client is running as part of the same Service Fabric application as the actor service it intends to communicate with. In this case, the application name is determined from CodePackageActivationContext, and is obtained by calling the getApplicationName() property.

Parameters:

actorInterfaceType - The actor interface implemented by the remote actor object. The returned proxy object will implement this interface.
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.
applicationName - Name of the Service Fabric application that contains the actor service hosting the actor objects. This parameter can be null if the client is running as part of that same Service Fabric application. For more information, see Remarks.

Returns:

An actor proxy object that implements ActorProxy and TActorInterface.

Throws:

URISyntaxException - Throws exception when invalid URI format is passed as applicationName

create

public static static T create(Class actorInterfaceType, ActorId actorId, String applicationName, String serviceName)

Creates a proxy to the actor object that implements an actor interface.

The applicationName parameter can be null if the client is running as part of the same Service Fabric application as the actor service it intends to communicate with. In this case, the application name is determined from CodePackageActivationContext, and is obtained by calling the getApplicationName() property.

Parameters:

actorInterfaceType - The actor interface implemented by the remote actor object. The returned proxy object will implement this interface.
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.
applicationName - Name of the Service Fabric application that contains the actor service hosting the actor objects. This parameter can be null if the client is running as part of that same Service Fabric application. For more information, see Remarks.
serviceName - Name of the Service Fabric service as configured by ActorServiceAttribute on the actor implementation. By default, the name of the service is derived from the name of the actor interface. However ActorServiceAttribute is required when an actor implements more than one actor interfaces or an actor interface derives from another actor interface as the determination of the serviceName cannot be made automatically.

Returns:

An actor proxy object that implements ActorProxy and TActorInterface.

Throws:

URISyntaxException - Throws exception when invalid URI format is passed as applicationName

create

public static static T create(Class actorInterfaceType, ActorId actorId, String applicationName, String serviceName, String listenerName)

Creates a proxy to the actor object that implements an actor interface.

The applicationName parameter can be null if the client is running as part of the same Service Fabric application as the actor service it intends to communicate with. In this case, the application name is determined from CodePackageActivationContext, and is obtained by calling the getApplicationName() property.

Parameters:

actorInterfaceType - The actor interface implemented by the remote actor object. The returned proxy object will implement this interface.
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.
applicationName - Name of the Service Fabric application that contains the actor service hosting the actor objects. This parameter can be null if the client is running as part of that same Service Fabric application. For more information, see Remarks.
serviceName - Name of the Service Fabric service as configured by ActorServiceAttribute on the actor implementation. By default, the name of the service is derived from the name of the actor interface. However ActorServiceAttribute is required when an actor implements more than one actor interfaces or an actor interface derives from another actor interface as the determination of the serviceName cannot be made automatically.
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.

Returns:

An actor proxy object that implements ActorProxy and TActorInterface.

Throws:

URISyntaxException - Throws exception when invalid URI format is passed as applicationName

create

public static static T create(Class actorInterfaceType, ActorId actorId, URI serviceUri)

Creates a proxy to the actor object that implements an actor interface.

Parameters:

actorInterfaceType - The actor interface implemented by the remote actor object. The returned proxy object will implement this interface.
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.
serviceUri - Uri of the actor service

Returns:

An actor proxy object that implements ActorProxy and TActorInterface. The actor interface implemented by the remote actor object. The returned proxy object will implement this interface.

create

public static static T create(Class actorInterfaceType, ActorId actorId, URI serviceUri, String listenerName)

Creates a proxy to the actor object that implements an actor interface.

Parameters:

actorInterfaceType - The actor interface implemented by the remote actor object. The returned proxy object will implement this interface.
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.
serviceUri - Uri of the actor service
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.

Returns:

An actor proxy object that implements ActorProxy and TActorInterface. The actor interface implemented by the remote actor object. The returned proxy object will implement this interface.

createRequestMessageBody

protected Object createRequestMessageBody(Object requestMessageBodyValue)

Parameters:

requestMessageBodyValue

deserializeMessage

protected Object deserializeMessage(byte[] msgBodyValue)

Parameters:

msgBodyValue

getActorId

public ActorId getActorId()

Gets ActorId associated with the proxy object.

Overrides:

ActorProxyBase.getActorId()

Returns:

ActorId associated with the proxy object.

getActorServicePartitionClient

public ActorServicePartitionClientImpl getActorServicePartitionClient()

Gets microsoft.servicefabric.actors.remoting.client.internal.ActorServicePartitionClientImpl that this proxy is using to communicate with the actor.

Overrides:

ActorProxyBase.getActorServicePartitionClient()

Returns:

microsoft.servicefabric.actors.remoting.client.internal.ActorServicePartitionClientImpl that this proxy is using to communicate with the actor.

getDefaultProxyFactory

public static FabricActorProxyFactory getDefaultProxyFactory()

Gets the default actor proxy factory.

Returns:

A default FabricActorProxyFactory object.

getResponseMessageBodyValue

protected Object getResponseMessageBodyValue(Object responseMessageBody)

Parameters:

responseMessageBody

initialize

public void initialize(ActorServicePartitionClientImpl actorServicePartitionClient)

Method to initialize the actor proxy instance For internal use only.

Parameters:

actorServicePartitionClient - instance of ActorServicePartitionClientImpl

invoke

protected void invoke(int interfaceId, int methodId, byte[] requestMsgBodyBytes)

Parameters:

interfaceId
methodId
requestMsgBodyBytes

invokeAsync

protected CompletableFuture invokeAsync(int interfaceId, int methodId, byte[] requestMsgBodyBytes, CancellationToken cancellationToken)

Parameters:

interfaceId
methodId
requestMsgBodyBytes
cancellationToken

serializeMessage

protected byte [] serializeMessage(Object msgBodyValue)

Parameters:

msgBodyValue

Applies to