다음을 통해 공유


ServiceProxyBase Class

  • java.lang.Object
    • ProxyBase
      • microsoft.servicefabric.services.remoting.client.ServiceProxyBase

public class ServiceProxyBase extends ProxyBase implements ServiceProxy

Provides the base implementation for the proxy to the remoted IService interfaces.

Method Summary

Modifier and Type Method and Description
static<T extends Service> T create(Class<T> serviceInterfaceType, URI serviceUri)
static<T extends Service> T create(Class<T> serviceInterfaceType, URI serviceUri, ServicePartitionKey partitionKey, TargetReplicaSelector targetReplicaSelector, String listenerName)

Creates a proxy to communicate to the specified service using the remoted interface TServiceInterface that the service implements.

Object createRequestMessageBody(Object requestMessageBodyValue)
Object deserializeMessage(byte[] msgBodyValue)
Object getResponseMessageBodyValue(Object responseMessageBody)
Class<?> getServiceInterfaceType()

The interface type that is being remoted.

ServiceRemotingPartitionClient getServicePartitionClient()

The service partition client used to send requests to the service.

void initialize(ServiceProxyGenerator serviceProxyGenerator, FabricServiceRemotingPartitionClient remotingPartitionClient)

Method to Initialize the service proxy instance. This is for internal use.

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

Method Details

create

public static static T create(Class serviceInterfaceType, URI serviceUri)

Parameters:

serviceInterfaceType
serviceUri

create

public static static T create(Class serviceInterfaceType, URI serviceUri, ServicePartitionKey partitionKey, TargetReplicaSelector targetReplicaSelector, String listenerName)

Creates a proxy to communicate to the specified service using the remoted interface TServiceInterface that the service implements.

Parameters:

serviceInterfaceType - Interface type that is being remoted
serviceUri - Uri of the Service.
partitionKey - The Partition key that determines which service partition is responsible for handling requests from this service proxy
targetReplicaSelector - Determines which replica or instance of the service partition the client should connect to.
listenerName - This parameter is Optional if the service has a single communication listener. The endpoints from the service are of the form {"Endpoints":{"Listener1":"Endpoint1","Listener2":"Endpoint2" ...}}. When the service exposes multiple endpoints, this parameter identifies which of those endpoints to use for the remoting communication.

Returns:

The proxy that implement the interface that is being remoted. The returned object also implement ServiceProxy interface.

createRequestMessageBody

protected Object createRequestMessageBody(Object requestMessageBodyValue)

Parameters:

requestMessageBodyValue

deserializeMessage

protected Object deserializeMessage(byte[] msgBodyValue)

Parameters:

msgBodyValue

getResponseMessageBodyValue

protected Object getResponseMessageBodyValue(Object responseMessageBody)

Parameters:

responseMessageBody

getServiceInterfaceType

public Class getServiceInterfaceType()

The interface type that is being remoted.

Overrides:

ServiceProxyBase.getServiceInterfaceType()

Returns:

Service interface type.

getServicePartitionClient

public ServiceRemotingPartitionClient getServicePartitionClient()

The service partition client used to send requests to the service.

Overrides:

ServiceProxyBase.getServicePartitionClient()

Returns:

ServicePartitionClient used by the ServiceProxy.

initialize

public void initialize(ServiceProxyGenerator serviceProxyGenerator, FabricServiceRemotingPartitionClient remotingPartitionClient)

Method to Initialize the service proxy instance. This is for internal use.

Parameters:

serviceProxyGenerator - instance of the serviceProxyGenerator
remotingPartitionClient - remotingPartitionClient used by Service proxy.

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