共用方式為


StatelessService Class

Definition

Represents the Microsoft Service Fabric based stateless reliable service base class. Derive from this class to implement a Microsoft Service Fabric based stateless reliable service.

public abstract class StatelessService
type StatelessService = class
Public MustInherit Class StatelessService
Inheritance
StatelessService

Constructors

StatelessService(StatelessServiceContext)

Initializes a new instance of the StatelessService class.

Properties

Context

Gets the service context that this stateless service is operating under. It provides information like InstanceId, PartitionId, ServiceName etc.

Partition

Gets service partition that this service instance belongs to.

Methods

CreateServiceInstanceListeners()

Override this method to supply the communication listeners for the service instance. The endpoints returned by the communication listener's are stored as a JSON string of ListenerName, Endpoint string pairs like {"Endpoints":{"Listener1":"Endpoint1","Listener2":"Endpoint2" ...}}

For information about Reliable Services life cycle please see https://docs.microsoft.com/azure/service-fabric/service-fabric-reliable-services-lifecycle

GetAddresses()

Gets the list of all the addresses for this service instance as (ListenerName, Endpoint) key-value pair.

OnAbort()

Notification that the service is being aborted. RunAsync MAY be running concurrently with the execution of this method, as cancellation is not awaited on the abort path.

For information about Reliable Services life cycle please see https://docs.microsoft.com/azure/service-fabric/service-fabric-reliable-services-lifecycle

OnCloseAsync(CancellationToken)

This method is called as the final step of closing the service. Override this method to be notified that Close has completed for this instance's internal components.

For information about Reliable Services life cycle please see https://docs.microsoft.com/azure/service-fabric/service-fabric-reliable-services-lifecycle

OnOpenAsync(CancellationToken)

This method is called as the final step of opening the service. Override this method to be notified that Open has completed for this instance's internal components.

For information about Reliable Services life cycle please see https://docs.microsoft.com/azure/service-fabric/service-fabric-reliable-services-lifecycle

RunAsync(CancellationToken)

Services that want to implement a background task, which runs when the service comes up, should override this method with their logic.

For information about Reliable Services life cycle please see https://docs.microsoft.com/azure/service-fabric/service-fabric-reliable-services-lifecycle

Applies to