ServiceReplicaListener Class

  • java.lang.Object
    • microsoft.servicefabric.services.communication.runtime.ServiceReplicaListener

public class ServiceReplicaListener

Represents the communication listener and its properties for a Stateful Service Replica. Endpoints given out by the communication listener are associated with name of the communication listener.

Field Summary

Modifier and Type Field and Description
final String defaultName

The default name used when the ServiceReplicaListener is not given a name.

Constructor Summary

Constructor Description
ServiceReplicaListener(Function<StatefulServiceContext, CommunicationListener> createCommunicationListener)
ServiceReplicaListener(Function<StatefulServiceContext, CommunicationListener> createCommunicationListener, String name)

Creates the ServiceReplicaListener

ServiceReplicaListener(Function<StatefulServiceContext, CommunicationListener> createCommunicationListener, String name, boolean listenOnSecondary)

Method Summary

Modifier and Type Method and Description
Function<StatefulServiceContext, CommunicationListener> createCommunicationListener()

Factory method for creating the communication listener.

boolean listenOnSecondary()

Indicates if this communication listener should be opened when the stateful service replica becomes an ActiveSecondary. When this member is not set(or set to false), the communication listener is opened only when the replica becomes Primary.

String name()

Name of the communication listener.

Field Details

defaultName

public static final String defaultName= ""

The default name used when the ServiceReplicaListener is not given a name.

Constructor Details

ServiceReplicaListener

public ServiceReplicaListener(Function createCommunicationListener)

Parameters:

createCommunicationListener

ServiceReplicaListener

public ServiceReplicaListener(Function createCommunicationListener, String name)

Creates the ServiceReplicaListener

Parameters:

createCommunicationListener - Factory method for creating the communication listener
name - Name of the communication listener. This parameter is optional, if the service has only one communication listener

ServiceReplicaListener

public ServiceReplicaListener(Function createCommunicationListener, String name, boolean listenOnSecondary)

Parameters:

createCommunicationListener
name
listenOnSecondary

Method Details

createCommunicationListener

public Function createCommunicationListener()

Factory method for creating the communication listener.

Returns:

Factory method

listenOnSecondary

public boolean listenOnSecondary()

Indicates if this communication listener should be opened when the stateful service replica becomes an ActiveSecondary. When this member is not set(or set to false), the communication listener is opened only when the replica becomes Primary.

Returns:

Boolean value that indicates if this communication listener should be opened when the replica is ActiveSecondary

name

public String name()

Name of the communication listener.

Returns:

Name

Applies to