...
Proposed notification format:
Notification | |
long | Resource ID (task ID, continuous query ID, etc) |
short | Message flags. Bitwise OR operation of following options: 0x0001 Error flag 0x0004 Notification flag (should always be set for notifications) |
short | Notification operation code |
int | Error code (if error flag is set) |
string | Error message (if error flag is set) |
... | Notification payload (if error flag isn't set) |
New request type should be added to start a new task:
...
To notify about task completion following notification code should be used:
Name | Code |
---|---|
OP_COMPUTE_TASK_FINISHED | 6001 |
To cancel the task existing request type should be used:
Name | Code |
---|---|
OP_RESOURCE_CLOSE | 0 |
...
Notification for successfully executed task | |
---|---|
long | Task ID (resource ID). |
short | Notification flag (0x0004) |
short | OP_COMPUTE_TASK_FINISHED (6001) |
object | Task result |
Notification for the failed task | |
---|---|
long | Task ID (resource ID). |
short | Notification flag | Error flag (0x0005) |
short | OP_COMPUTE_TASK_FINISHED (6001) |
int | Error code |
string | Error message |
Proposed task execution workflow:
Currently, protocol versions are used to support backward-compatibility. Sometimes it's not convenient since to support some feature client should increase protocol version and support all other features introduced in all the previous versions of the protocol. This problem can be solved by using feature masks. Clients and servers should inform each other on handshake about features that they supported.
Proposed changes to handshake request and response:
Request | ||
byte | Handshake code, always 1 | |
short | Version major | |
short | Version minor | |
short | Version patch | |
byte | Client code, always 2 | |
int | Client features mask array length | Since version 2.0.0 (new field) |
byte[] | Client features mask array | Since version 2.0.0 (new field) |
Map | User attributes | Since version 1.7.0 |
String | Username (optional) | Since version 1.1.0 |
String | Password (optional) | Since version 1.1.0 |
Response (success) | ||
byte | Success flag, 1 | |
int | Server features mask array length | Since version 2.0.0 (new field) |
byte[] | Server features mask array | Since version 2.0.0 (new field) |
UUID | Node id | Since version 1.4.0 |
Features mask - it's an array, where some bit is set if the feature with the corresponding id is supported.
For compute tasks execution following future should be introduced:
Feature | id |
---|---|
EXECUTE_TASK_BY_NAME | 0 |
So, bit 0 should be set on features mask if the client supports this feature.
...