Add destinations improvements #62
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When sending a message or transferring a blob, the recipient ID can now contain an additional identifier. Also, the sender can be explicitly included which may also contain an additional identifier.
Example:
POST /api/v1/messagesPayload:
{ "recipient": "org-b/ns-a", "sender": "org-a/ns-x", "message": "test 1-2-3" }Response:
{ "requestId": "cee8e73e-4a97-4be7-abc8-f82de1e62939" }Sender receives event:
{ "id": "58e7a4b8-046e-478b-a82c-daa9eb9aae01", "type": "message-delivered", "message": "test 1-2-3", "sender": "org-a/ns-y", "recipient": "org-b/ns-x", "requestId": "cee8e73e-4a97-4be7-abc8-f82de1e62939" }Recipient receives event:
{ "id": "8d3351a8-bb83-4ce2-906d-4d099f8e2492", "type": "message-received", "sender": "org-a/ns-y", "recipient": "org-b/ns-x", "message": "test 1-2-3" }Similarly when transferring blobs:
POST /api/v1/transfersPayload:
{ "path": "/photo.jpg", "sender": "org-a/ns-x", "recipient": "org-b/ns-y" }Response:
{ "requestId": "ba830d2c-dd39-48ce-ab70-dbfa610dc606" }Sender receives event:
{ "id": "16354dfb-1644-404e-a23c-51dd62d0d5d9", "type": "blob-delivered", "path": "/photo.jpg", "sender": "org-a/ns-x", "recipient": "org-b/ns-y", "requestId": "ba830d2c-dd39-48ce-ab70-dbfa610dc606" }Recipient receives event:
{ "id": "bb745fe8-8837-436f-9d20-315dc0da01a5", "type": "blob-received", "sender": "org-a/ns-x", "recipient": "org-b/ns-y", "path": "received/org-a/ns-x/photo.jpg", "hash": "9707a075644e450ebec9c87dfa3b79b53e51f878cfc0394b80c30949f4d2000c", "size": 146866, "lastUpdate": 1658437514514 }Notice the folder structure, the file is stored in a subdirectory based on the additional identifier.
Note also that these changes are backward compatible as the additional identifiers are optional.
Also included in this PR: