Search Results for

Show / Hide Table of Contents

# Interface IServices

Defines functionality to deploy distributed services in the Ignite.

###### Namespace: Apache.Ignite.Core.Services

###### Assembly: Apache.Ignite.Core.dll

##### Syntax

    public interface IServices

### Properties

#### ClusterGroup

Gets the cluster group to which this instance belongs.

##### Declaration

    IClusterGroup ClusterGroup { get; }

##### Property Value

Type | Description
--- | ---
IClusterGroup | The cluster group to which this instance belongs.

### Methods

#### Cancel(String)

Cancels service deployment. If a service with specified name was deployed on the grid, then Cancel(IServiceContext) method will be called on it.

Note that Ignite cannot guarantee that the service exits from Execute(IServiceContext) method whenever Cancel(IServiceContext) is called. It is up to the user to make sure that the service code properly reacts to cancellations.

##### Declaration

    void Cancel(string name)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | name | Name of the service to cancel.

#### CancelAll()

Cancels all deployed services.

Note that depending on user logic, it may still take extra time for a service to finish execution, even after it was cancelled.

##### Declaration

    void CancelAll()

#### CancelAllAsync()

Cancels all deployed services.

Note that depending on user logic, it may still take extra time for a service to finish execution, even after it was cancelled.

##### Declaration

    Task CancelAllAsync()

##### Returns

Type | Description
--- | ---
Task |

#### CancelAsync(String)

Cancels service deployment. If a service with specified name was deployed on the grid, then Cancel(IServiceContext) method will be called on it.

Note that Ignite cannot guarantee that the service exits from Execute(IServiceContext) method whenever Cancel(IServiceContext) is called. It is up to the user to make sure that the service code properly reacts to cancellations.

##### Declaration

    Task CancelAsync(string name)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | name | Name of the service to cancel.

##### Returns

Type | Description
--- | ---
Task |

#### Deploy(ServiceConfiguration)

Deploys instances of the service in the Ignite according to provided configuration.

##### Declaration

    void Deploy(ServiceConfiguration configuration)

##### Parameters

Type | Name | Description
--- | --- | ---
ServiceConfiguration | configuration | Service configuration.

#### DeployAll(IEnumerable<ServiceConfiguration>)

Deploys multiple services described by provided configurations. Depending on specified parameters, multiple instances of the same service may be deployed. Whenever topology changes, Ignite will automatically rebalance the deployed services within cluster to make sure that each node will end up with about equal number of deployed instances whenever possible.

If deployment of some of the provided services fails, then ServiceDeploymentException containing a list of failed service configurations (FailedConfigurations) will be thrown. It is guaranteed that all services that were provided to this method and are not present in the list of failed services are successfully deployed by the moment of the exception being thrown. Note that if exception is thrown, then partial deployment may have occurred.

##### Declaration

    void DeployAll(IEnumerable<ServiceConfiguration> configurations)

##### Parameters

Type | Name | Description
--- | --- | ---
IEnumerable<ServiceConfiguration> | configurations | Collection of service configurations to be deployed.

#### DeployAllAsync(IEnumerable<ServiceConfiguration>)

Asynchronously deploys multiple services described by provided configurations. Depending on specified parameters, multiple instances of the same service may be deployed (ServiceConfiguration). Whenever topology changes, Ignite will automatically rebalance the deployed services within cluster to make sure that each node will end up with about equal number of deployed instances whenever possible.

If deployment of some of the provided services fails, then ServiceDeploymentException containing a list of failed service configurations (FailedConfigurations) will be thrown. It is guaranteed that all services, that were provided to this method and are not present in the list of failed services, are successfully deployed by the moment of the exception being thrown. Note that if exception is thrown, then partial deployment may have occurred.

##### Declaration

    Task DeployAllAsync(IEnumerable<ServiceConfiguration> configurations)

##### Parameters

Type | Name | Description
--- | --- | ---
IEnumerable<ServiceConfiguration> | configurations | Collection of service configurations to be deployed.

##### Returns

Type | Description
--- | ---
Task |

#### DeployAsync(ServiceConfiguration)

Deploys instances of the service in the Ignite according to provided configuration.

##### Declaration

    Task DeployAsync(ServiceConfiguration configuration)

##### Parameters

Type | Name | Description
--- | --- | ---
ServiceConfiguration | configuration | Service configuration.

##### Returns

Type | Description
--- | ---
Task |

#### DeployClusterSingleton(String, IService)

Deploys a cluster-wide singleton service. Ignite guarantees that there is always one instance of the service in the cluster. In case if Ignite node on which the service was deployed crashes or stops, Ignite will automatically redeploy it on another node. However, if the node on which the service is deployed remains in topology, then the service will always be deployed on that node only, regardless of topology changes.

Note that in case of topology changes, due to network delays, there may be a temporary situation when a singleton service instance will be active on more than one node (e.g. crash detection delay).

##### Declaration

    void DeployClusterSingleton(string name, IService service)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | name | Service name.
IService | service | Service instance.

#### DeployClusterSingletonAsync(String, IService)

Deploys a cluster-wide singleton service. Ignite guarantees that there is always one instance of the service in the cluster. In case if Ignite node on which the service was deployed crashes or stops, Ignite will automatically redeploy it on another node. However, if the node on which the service is deployed remains in topology, then the service will always be deployed on that node only, regardless of topology changes.

Note that in case of topology changes, due to network delays, there may be a temporary situation when a singleton service instance will be active on more than one node (e.g. crash detection delay).

##### Declaration

    Task DeployClusterSingletonAsync(string name, IService service)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | name | Service name.
IService | service | Service instance.

##### Returns

Type | Description
--- | ---
Task |

#### DeployKeyAffinitySingleton<TK>(String, IService, String, TK)

Deploys one instance of this service on the primary node for a given affinity key. Whenever topology changes and primary node assignment changes, Ignite will always make sure that the service is undeployed on the previous primary node and deployed on the new primary node.

Note that in case of topology changes, due to network delays, there may be a temporary situation when a service instance will be active on more than one node (e.g. crash detection delay).

##### Declaration

    void DeployKeyAffinitySingleton<TK>(string name, IService service, string cacheName, TK affinityKey)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | name | Service name.
IService | service | Service instance.
System.String | cacheName | Name of the cache on which affinity for key should be calculated, null for default cache.
TK | affinityKey | Affinity cache key.

##### Type Parameters

Name | Description
--- | ---
TK |

#### DeployKeyAffinitySingletonAsync<TK>(String, IService, String, TK)

Deploys one instance of this service on the primary node for a given affinity key. Whenever topology changes and primary node assignment changes, Ignite will always make sure that the service is undeployed on the previous primary node and deployed on the new primary node.

Note that in case of topology changes, due to network delays, there may be a temporary situation when a service instance will be active on more than one node (e.g. crash detection delay).

##### Declaration

    Task DeployKeyAffinitySingletonAsync<TK>(string name, IService service, string cacheName, TK affinityKey)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | name | Service name.
IService | service | Service instance.
System.String | cacheName | Name of the cache on which affinity for key should be calculated, null for default cache.
TK | affinityKey | Affinity cache key.

##### Returns

Type | Description
--- | ---
Task |

##### Type Parameters

Name | Description
--- | ---
TK |

#### DeployMultiple(String, IService, Int32, Int32)

Deploys multiple instances of the service on the grid. Ignite will deploy a maximum amount of services equal to `totalCount` parameter making sure that there are no more than `maxPerNodeCount` service instances running on each node. Whenever topology changes, Ignite will automatically rebalance the deployed services within cluster to make sure that each node will end up with about equal number of deployed instances whenever possible.

##### Declaration

    void DeployMultiple(string name, IService service, int totalCount, int maxPerNodeCount)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | name | Service name.
IService | service | Service instance.
System.Int32 | totalCount | Maximum number of deployed services in the grid, 0 for unlimited.
System.Int32 | maxPerNodeCount | Maximum number of deployed services on each node, 0 for unlimited.

#### DeployMultipleAsync(String, IService, Int32, Int32)

Deploys multiple instances of the service on the grid. Ignite will deploy a maximum amount of services equal to `totalCount` parameter making sure that there are no more than `maxPerNodeCount` service instances running on each node. Whenever topology changes, Ignite will automatically rebalance the deployed services within cluster to make sure that each node will end up with about equal number of deployed instances whenever possible.

##### Declaration

    Task DeployMultipleAsync(string name, IService service, int totalCount, int maxPerNodeCount)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | name | Service name.
IService | service | Service instance.
System.Int32 | totalCount | Maximum number of deployed services in the grid, 0 for unlimited.
System.Int32 | maxPerNodeCount | Maximum number of deployed services on each node, 0 for unlimited.

##### Returns

Type | Description
--- | ---
Task |

#### DeployNodeSingleton(String, IService)

Deploys a per-node singleton service. Ignite guarantees that there is always one instance of the service running on each node. Whenever new nodes are started within the underlying cluster group, Ignite will automatically deploy one instance of the service on every new node.

##### Declaration

    void DeployNodeSingleton(string name, IService service)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | name | Service name.
IService | service | Service instance.

#### DeployNodeSingletonAsync(String, IService)

Deploys a per-node singleton service. Ignite guarantees that there is always one instance of the service running on each node. Whenever new nodes are started within the underlying cluster group, Ignite will automatically deploy one instance of the service on every new node.

##### Declaration

    Task DeployNodeSingletonAsync(string name, IService service)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | name | Service name.
IService | service | Service instance.

##### Returns

Type | Description
--- | ---
Task |

#### GetDynamicServiceProxy(String)

Gets a handle on remote or local service as a dynamic object. The proxy is dynamically created and provided for the specified service.

This method utilizes `dynamic` feature of the language and does not require any service interfaces or classes. Java services can be accessed as well as .NET services.

##### Declaration

    dynamic GetDynamicServiceProxy(string name)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | name | Service name.

##### Returns

Type | Description
--- | ---
System.Object | Proxy over service.

#### GetDynamicServiceProxy(String, Boolean)

Gets a handle on remote or local service as a dynamic object. The proxy is dynamically created and provided for the specified service.

This method utilizes `dynamic` feature of the language and does not require any service interfaces or classes. Java services can be accessed as well as .NET services.

##### Declaration

    dynamic GetDynamicServiceProxy(string name, bool sticky)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | name | Service name.
System.Boolean | sticky | Whether or not Ignite should always contact the same remote service or try to load-balance between services.

##### Returns

Type | Description
--- | ---
System.Object | Proxy over service.

#### GetDynamicServiceProxy(String, Boolean, IServiceCallContext)

Gets a handle on remote or local service as a dynamic object with the specified caller context. The proxy is dynamically created and provided for the specified service.

This method utilizes `dynamic` feature of the language and does not require any service interfaces or classes. Java services can be accessed as well as .NET services.

##### Declaration

    dynamic GetDynamicServiceProxy(string name, bool sticky, IServiceCallContext callCtx)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | name | Service name.
System.Boolean | sticky | Whether or not Ignite should always contact the same remote service or try to load-balance between services.
IServiceCallContext | callCtx | Service call context.

##### Returns

Type | Description
--- | ---
System.Object | Proxy over service.

##### See Also

IServiceCallContext

#### GetService<T>(String)

Gets deployed service with specified name.

##### Declaration

    T GetService<T>(string name)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | name | Service name.

##### Returns

Type | Description
--- | ---
T | Deployed service with specified name.

##### Type Parameters

Name | Description
--- | ---
T | Service type.

#### GetServiceDescriptors()

Gets metadata about all deployed services.

##### Declaration

    ICollection<IServiceDescriptor> GetServiceDescriptors()

##### Returns

Type | Description
--- | ---
ICollection<IServiceDescriptor> | Metadata about all deployed services.

#### GetServiceProxy<T>(String)

Gets a handle on remote or local service. The proxy is dynamically created and provided for the specified service.

##### Declaration

    T GetServiceProxy<T>(string name)
        where T : class

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | name | Service name.

##### Returns

Type | Description
--- | ---
T | Proxy over service.

##### Type Parameters

Name | Description
--- | ---
T | Service type.

#### GetServiceProxy<T>(String, Boolean)

Gets a handle on remote or local service. The proxy is dynamically created and provided for the specified service.

##### Declaration

    T GetServiceProxy<T>(string name, bool sticky)
        where T : class

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | name | Service name.
System.Boolean | sticky | Whether or not Ignite should always contact the same remote service or try to load-balance between services.

##### Returns

Type | Description
--- | ---
T | Proxy over service.

##### Type Parameters

Name | Description
--- | ---
T | Service type.

#### GetServiceProxy<T>(String, Boolean, IServiceCallContext)

Gets a handle on remote or local service with the specified caller context. The proxy is dynamically created and provided for the specified service.

##### Declaration

    T GetServiceProxy<T>(string name, bool sticky, IServiceCallContext callCtx)
        where T : class

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | name | Service name.
System.Boolean | sticky | Whether or not Ignite should always contact the same remote service or try to load-balance between services.
IServiceCallContext | callCtx | Service call context.

##### Returns

Type | Description
--- | ---
T | Proxy over service.

##### Type Parameters

Name | Description
--- | ---
T | Service type.

##### See Also

IServiceCallContext

#### GetServices<T>(String)

Gets all deployed services with specified name.

##### Declaration

    ICollection<T> GetServices<T>(string name)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | name | Service name.

##### Returns

Type | Description
--- | ---
ICollection<T> | All deployed services with specified name.

##### Type Parameters

Name | Description
--- | ---
T | Service type.

#### WithKeepBinary()

Returns an instance with binary mode enabled. Service method results will be kept in binary form.

##### Declaration

    IServices WithKeepBinary()

##### Returns

Type | Description
--- | ---
IServices | Instance with binary mode enabled.

#### WithServerKeepBinary()

Returns an instance with server-side binary mode enabled. Service method arguments will be kept in binary form.

##### Declaration

    IServices WithServerKeepBinary()

##### Returns

Type | Description
--- | ---
IServices | Instance with server-side binary mode enabled.