Client Sessions
- Last UpdatedJul 11, 2023
- 5 minute read
API for Client Sessions.
List Client Sessions
Returns the list of client sessions belonging to the specified group.
Request
GET /api/v1/tenants/{tenantId}/namespaces/{namespaceId}/clientfailover/groups/{groupId}/clientsessions
Parameters
string tenantId
string namespaceId
string groupId
The identifier of the failover group.
Response
| Status Code | Body Type | Description |
|---|---|---|
| 200 | ClientSession[] | A list of client sessions. |
| 400 | ErrorResponse | Request is not valid. See the response body for additional details. |
| 403 | ErrorResponse | Request is not authorized. |
| 404 | ErrorResponse | A failover group with the specified identifier was not found. |
| 503 | ErrorResponse | Service unavailable. |
Example response body
200 Response (ClientSession[])
[
{
"Id": "string",
"Name": "string",
"Heartbeat": {
"FailoverScore": 0,
"LastDataProcessedTime": "2019-08-24T14:15:22Z",
"HeartbeatTime": "2019-08-24T14:15:22Z"
},
"Role": 0,
"HeartbeatPosted": true,
"RoleOverride": 0,
"RoleOverrideExpirationTime": "2019-08-24T14:15:22Z",
"AdditionalData": {
"property1": null,
"property2": null
}
}
]
Post Client Session
Creates a client session from specified session configuration.
Request
POST /api/v1/tenants/{tenantId}/namespaces/{namespaceId}/clientfailover/groups/{groupId}/clientsessions
Parameters
string tenantId
string namespaceId
string groupId
The identifier of the failover group.
Request Body
The client session being created.
{
"Id": "string",
"Name": "string"
}
Response
| Status Code | Body Type | Description |
|---|---|---|
| 200 | ClientSession | Client session with matching id and configuration exists. |
| 201 | ClientSession | The client session was created. |
| 400 | ErrorResponse | Request is not valid. See the response body for additional details. |
| 403 | ErrorResponse | Request is not authorized. |
| 404 | ErrorResponse | A failover group with the specified identifier was not found. |
| 409 | ErrorResponse | A client session with the specified configuration already exists. |
| 503 | ErrorResponse | Service unavailable. |
Example response body
200 Response (ClientSession)
{
"Id": "string",
"Name": "string",
"Heartbeat": {
"FailoverScore": 0,
"LastDataProcessedTime": "2019-08-24T14:15:22Z",
"HeartbeatTime": "2019-08-24T14:15:22Z"
},
"Role": 0,
"HeartbeatPosted": true,
"RoleOverride": 0,
"RoleOverrideExpirationTime": "2019-08-24T14:15:22Z",
"AdditionalData": {
"property1": null,
"property2": null
}
}
Get Client Session
Gets a client session by identifier.
Request
GET /api/v1/tenants/{tenantId}/namespaces/{namespaceId}/clientfailover/groups/{groupId}/clientsessions/{sessionId}
Parameters
string tenantId
string namespaceId
string groupId
The identifier of the failover group.string sessionId
The identifier of the client session.
Response
| Status Code | Body Type | Description |
|---|---|---|
| 200 | ClientSession | Client session with the specified identifier. |
| 400 | ErrorResponse | Request is not valid. See the response body for additional details. |
| 403 | ErrorResponse | Request is not authorized. |
| 404 | ErrorResponse | A failover group or client session with the specified identifier was not found. |
| 503 | ErrorResponse | Service unavailable. |
Example response body
200 Response (ClientSession)
{
"Id": "string",
"Name": "string",
"Heartbeat": {
"FailoverScore": 0,
"LastDataProcessedTime": "2019-08-24T14:15:22Z",
"HeartbeatTime": "2019-08-24T14:15:22Z"
},
"Role": 0,
"HeartbeatPosted": true,
"RoleOverride": 0,
"RoleOverrideExpirationTime": "2019-08-24T14:15:22Z",
"AdditionalData": {
"property1": null,
"property2": null
}
}
Delete Client Session
Deletes a client session by identifier.
Request
DELETE /api/v1/tenants/{tenantId}/namespaces/{namespaceId}/clientfailover/groups/{groupId}/clientsessions/{sessionId}
Parameters
string tenantId
string namespaceId
string groupId
The identifier of the failover group.string sessionId
The identifier of the client session.
Response
| Status Code | Body Type | Description |
|---|---|---|
| 204 | None | The client session was deleted. |
| 400 | ErrorResponse | Request is not valid. See the response body for additional details. |
| 403 | ErrorResponse | Request is not authorized. |
| 404 | ErrorResponse | A failover group or client session with the specified identifier was not found. |
| 503 | ErrorResponse | Service unavailable. |
Post Heartbeat Message
Posts a heartbeat to the client session.
Request
POST /api/v1/tenants/{tenantId}/namespaces/{namespaceId}/clientfailover/groups/{groupId}/clientsessions/{sessionId}/heartbeat
Parameters
string tenantId
string namespaceId
string groupId
The identifier of the failover group.string sessionId
The identifier of the client session.
Request Body
The heartbeat of the client session.
{
"FailoverScore": 100
}
Response
| Status Code | Body Type | Description |
|---|---|---|
| 200 | FailoverHeartbeatResponse | The failover response. |
| 400 | ErrorResponse | Request is not valid. See the response body for additional details. |
| 403 | ErrorResponse | Request is not authorized. |
| 404 | ErrorResponse | A failover group or client session with the specified identifier was not found. |
| 429 | ErrorResponse | Too many requests. |
| 503 | ErrorResponse | Service unavailable. |
Example response body
200 Response (FailoverHeartbeatResponse)
{
"Role": 0,
"LastDataProcessedTime": "2019-08-24T14:15:22Z"
}
Post Role Override
Posts role override to the client session.
Request
POST /api/v1/tenants/{tenantId}/namespaces/{namespaceId}/clientfailover/groups/{groupId}/clientsessions/{sessionId}/roleoverride
Parameters
string tenantId
string namespaceId
string groupId
The identifier of the failover group.string sessionId
The identifier of the client session.
Request Body
The role override detail configuration for the client session RoleOverrideConfiguration. Role override value of Primary puts session as forced Primary and Off puts session's role back to be automatically calculated. Optional "expirationPeriod" of timespan in the format of "d.hh:mm:ss". "expirationPeriod" value is only applicable when role override value is Primary. When not specified, default is no expiration time.
{
"Value": 0,
"ExpirationPeriod": "string"
}
Response
| Status Code | Body Type | Description |
|---|---|---|
| 200 | RoleOverrideResponse | The failover response. |
| 400 | ErrorResponse | Request is not valid. See the response body for additional details. |
| 403 | ErrorResponse | Request is not authorized. |
| 404 | ErrorResponse | A failover group or client session with the specified identifier was not found. |
| 503 | ErrorResponse | Service unavailable. |
Example response body
200 Response (RoleOverrideResponse)
{
"Value": 0,
"RoleOverrideExpirationTime": "2019-08-24T14:15:22Z"
}
Definitions
ClientSession
Properties
| Property Name | Data Type | Required | Nullable | Description |
|---|---|---|---|---|
| Id | string | false | true | Unique client session identifier |
| Name | string | false | true | Friendly name of client session |
| Heartbeat | IFailoverHeartbeat | false | true | Client failover heartbeat |
| Role | ClientRole | false | false | Client failover role |
| HeartbeatPosted | boolean | false | false | Whether a heartbeat has been Posted from the session. |
| RoleOverride | RoleOverride | false | false | Client Session's role override value. Off: Role is automatically calculated by Failover Engine. (Default). Primary: Client is designated as forced Primary and its Role is not calculated by Failover Engine. |
| RoleOverrideExpirationTime | date-time | false | true | When the role override expires. If null, never expires. Only applicable when role override value is Primary. If role override value is Off, it will never expire regardless of the RoleOverrideExpirationTime. |
| AdditionalData | object | false | true | Additional session data. |
{
"Id": "string",
"Name": "string",
"Heartbeat": {
"FailoverScore": 0,
"LastDataProcessedTime": "2019-08-24T14:15:22Z",
"HeartbeatTime": "2019-08-24T14:15:22Z"
},
"Role": 0,
"HeartbeatPosted": true,
"RoleOverride": 0,
"RoleOverrideExpirationTime": "2019-08-24T14:15:22Z",
"AdditionalData": {
"property1": null,
"property2": null
}
}
IFailoverHeartbeat
Failover heartbeat.
Properties
| Property Name | Data Type | Required | Nullable | Description |
|---|---|---|---|---|
| FailoverScore | float | false | false | The percentage of active streams managed by an adapter. |
| LastDataProcessedTime | date-time | false | true | Last time data was processed by client. |
| HeartbeatTime | date-time | false | false | UTC time that the client generated the heartbeat message. |
{
"FailoverScore": 0,
"LastDataProcessedTime": "2019-08-24T14:15:22Z",
"HeartbeatTime": "2019-08-24T14:15:22Z"
}
ClientRole
Client failover roles.
Enumerated Values
| Property | Value | Description |
|---|---|---|
| Secondary | 0 | Client failover roles. |
| Primary | 1 | Client failover roles. |
| PendingPrimary | 2 | Client failover roles. |
RoleOverride
Client failover role override.
Enumerated Values
| Property | Value | Description |
|---|---|---|
| Off | 0 | Client failover role override. |
| Primary | 1 | Client failover role override. |
ErrorResponse
Response error for controller methods.
Properties
| Property Name | Data Type | Required | Nullable | Description |
|---|---|---|---|---|
| OperationId | string | false | true | Operation identifier |
| Error | string | false | true | Error string |
| Reason | string | false | true | Error reason string |
| Resolution | string | false | true | Resolution string |
| AdditionalParameters | object | false | true | Additional parameters to add to the response. |
{
"OperationId": "string",
"Error": "string",
"Reason": "string",
"Resolution": "string",
"AdditionalParameters": {
"property1": null,
"property2": null
},
"property1": null,
"property2": null
}
ClientSessionConfiguration
Configuration for creating a new client session.
Properties
| Property Name | Data Type | Required | Nullable | Description |
|---|---|---|---|---|
| Id | string | false | true | Unique client session identifier |
| Name | string | false | true | Friendly name of client session. |
{
"Id": "string",
"Name": "string"
}
FailoverHeartbeatResponse
Properties
| Property Name | Data Type | Required | Nullable | Description |
|---|---|---|---|---|
| Role | ClientRole | false | false | Role of the client |
| LastDataProcessedTime | date-time | false | true | Last time data was processed by client |
{
"Role": 0,
"LastDataProcessedTime": "2019-08-24T14:15:22Z"
}
FailoverHeartbeatRequest
Properties
| Property Name | Data Type | Required | Nullable | Description |
|---|---|---|---|---|
| FailoverScore | float | true | false | The percentage of active streams managed by an adapter. |
{
"FailoverScore": 100
}
RoleOverrideResponse
Response to the role override request.
Properties
| Property Name | Data Type | Required | Nullable | Description |
|---|---|---|---|---|
| Value | RoleOverride | false | false | Role override value. RoleOverride. |
| RoleOverrideExpirationTime | date-time | false | true | Role override expiration time. If null, never expires. |
{
"Value": 0,
"RoleOverrideExpirationTime": "2019-08-24T14:15:22Z"
}
RoleOverrideConfiguration
Properties
| Property Name | Data Type | Required | Nullable | Description |
|---|---|---|---|---|
| Value | RoleOverride | false | false | Client session role override value. |
| ExpirationPeriod | time-span | false | true | RoleOverride expires after this TimeSpan elapses. If null, never expires. |
{
"Value": 0,
"ExpirationPeriod": "string"
}