Partilhar via


FabricClient Class

  • java.lang.Object
    • AutoCloseable
      • system.fabric.FabricClient

public class FabricClient

Client for a Service Fabric cluster.

Remarks:It is highly recommended that you share FabricClients as much as possible. This is because the FabricClient has multiple optimizations such as caching and batching that you would not be able to fully utilize otherwise.

Constructor Summary

Constructor Description
FabricClient()

Initializes a new instance of the system.fabric.FabricClient class.

Remarks:If the system.fabric.FabricClient is on the same cluster as the service, then use a Local system.fabric.FabricClient. Local system.fabric.FabricClient is a feature of Service Fabric that allows the system.fabric.FabricClient to connect to the local Gateway Service instead of choosing from a list. This way, your client can bypass an extra network hop. In case a service is resolving another service partition in the same cluster, then it is recommended that you use Local system.fabric.FabricClient , as it enables automatic load balancing and improves performance.

FabricClient(FabricClientRole clientRole)

Initializes a new instance of the FabricClient class with the specified fabric client role.

FabricClient(FabricClientSettings settings)

Initializes a new instance of the system.fabric.FabricClient class with the desired fabric client settings. If the system.fabric.FabricClient is on the same cluster as the service, then use a Local system.fabric.FabricClient. Local system.fabric.FabricClient is a feature of Service Fabric that allows the system.fabric.FabricClient to connect to the local Gateway Service instead of choosing from a list. This way, your client can bypass an extra network hop. In case a service is resolving another service partition in the same cluster, then it is recommended that you use Local system.fabric.FabricClient, as it enables automatic load balancing and improves performance.

FabricClient(FabricClientSettings settings, String[] hostEndpoints)

Initializes a new instance of the system.fabric.FabricClient class with given Service Fabric Gateway addresses (hostEndpoints) and the desired fabric client settings.

FabricClient(SecurityCredentials credential, FabricClientSettings settings, String[] hostEndpoints)

Initializes a new instance of the system.fabric.FabricClient class with given Service Fabric Gateway addresses (hostEndpoints), security credentials and fabric client settings.

FabricClient(SecurityCredentials credential, String[] hostEndpoints)

Initializes a new instance of the system.fabric.FabricClient class with given Service Fabric Gateway addresses (hostEndpoints) and security credentials.

FabricClient(String[] hostEndpoints)

Initializes a new instance of the system.fabric.FabricClient class with given Service Fabric Gateway addresses (hostEndpoints).

Method Summary

Modifier and Type Method and Description
void close()
void createNativeClient(String[] hostEndPoints)
Observable<GatewayInformation> getClientConnectionObservable()
Observable<GatewayInformation> getClientDisconnectionObservable()
SecurityCredentials getCredential()
String [] getHostEndpoints()
FabricClientSettings getSettings()

Gets the fabric client settings.

void registerOnClaimsRetrievalCallback(BiFunction<FabricClient, AzureActiveDirectoryMetadata, String> callback)

Registers the claims token retrieval callback for the ClaimsRetrieval event

void updateSecurityCredentials(SecurityCredentials credentials)

Updates the fabric client security credentials.

void UpdateSettings(FabricClientSettings settings)

Constructor Details

FabricClient

public FabricClient()

Initializes a new instance of the system.fabric.FabricClient class.

Remarks:If the system.fabric.FabricClient is on the same cluster as the service, then use a Local system.fabric.FabricClient. Local system.fabric.FabricClient is a feature of Service Fabric that allows the system.fabric.FabricClient to connect to the local Gateway Service instead of choosing from a list. This way, your client can bypass an extra network hop. In case a service is resolving another service partition in the same cluster, then it is recommended that you use Local system.fabric.FabricClient , as it enables automatic load balancing and improves performance.

FabricClient

public FabricClient(FabricClientRole clientRole)

Initializes a new instance of the FabricClient class with the specified fabric client role.

Parameters:

clientRole - The fabric client role

FabricClient

public FabricClient(FabricClientSettings settings)

Initializes a new instance of the system.fabric.FabricClient class with the desired fabric client settings. If the system.fabric.FabricClient is on the same cluster as the service, then use a Local system.fabric.FabricClient. Local system.fabric.FabricClient is a feature of Service Fabric that allows the system.fabric.FabricClient to connect to the local Gateway Service instead of choosing from a list. This way, your client can bypass an extra network hop. In case a service is resolving another service partition in the same cluster, then it is recommended that you use Local system.fabric.FabricClient, as it enables automatic load balancing and improves performance.

Parameters:

settings - The fabric client settings used by the fabric client.

FabricClient

public FabricClient(FabricClientSettings settings, String[] hostEndpoints)

Initializes a new instance of the system.fabric.FabricClient class with given Service Fabric Gateway addresses (hostEndpoints) and the desired fabric client settings.

Parameters:

settings - The fabric client settings.
hostEndpoints - Defines the set of Gateway addresses the system.fabric.FabricClient can use to connect to the cluster.

FabricClient

public FabricClient(SecurityCredentials credential, FabricClientSettings settings, String[] hostEndpoints)

Initializes a new instance of the system.fabric.FabricClient class with given Service Fabric Gateway addresses (hostEndpoints), security credentials and fabric client settings.

Parameters:

credential -

SecurityCredentials defines the security settings for the system.fabric.FabricClient.

settings - The fabric client settings.
hostEndpoints - Defines the set of Gateway addresses the system.fabric.FabricClient can use to connect to the cluster.

FabricClient

public FabricClient(SecurityCredentials credential, String[] hostEndpoints)

Initializes a new instance of the system.fabric.FabricClient class with given Service Fabric Gateway addresses (hostEndpoints) and security credentials.

Parameters:

credential -

SecurityCredentials defines the security settings for the system.fabric.FabricClient.

hostEndpoints - Defines the set of Gateway addresses the system.fabric.FabricClient can use to connect to the cluster.

FabricClient

public FabricClient(String[] hostEndpoints)

Initializes a new instance of the system.fabric.FabricClient class with given Service Fabric Gateway addresses (hostEndpoints).

Parameters:

hostEndpoints - Defines the set of Gateway addresses the system.fabric.FabricClient can use to connect to the cluster.

Method Details

close

public void close()

createNativeClient

public void createNativeClient(String[] hostEndPoints)

Parameters:

hostEndPoints

getClientConnectionObservable

public Observable getClientConnectionObservable()

getClientDisconnectionObservable

public Observable getClientDisconnectionObservable()

getCredential

public SecurityCredentials getCredential()

getHostEndpoints

public String [] getHostEndpoints()

getSettings

public FabricClientSettings getSettings()

Gets the fabric client settings.

Returns:

The fabric client settings.

registerOnClaimsRetrievalCallback

public void registerOnClaimsRetrievalCallback(BiFunction callback)

Registers the claims token retrieval callback for the ClaimsRetrieval event

Parameters:

callback - function which takes system.fabric.security.AzureActiveDirectoryMetadata as input which is required for acquiring a claims token from Azure Active Directory and returns claims token.

updateSecurityCredentials

public void updateSecurityCredentials(SecurityCredentials credentials)

Updates the fabric client security credentials.

Parameters:

credentials - The new security credentials to be used.

UpdateSettings

public void UpdateSettings(FabricClientSettings settings)

Parameters:

settings

Applies to