Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor some synchronous API calls to async #1378

Open
1 task done
oyo opened this issue Nov 27, 2024 · 0 comments
Open
1 task done

Refactor some synchronous API calls to async #1378

oyo opened this issue Nov 27, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@oyo
Copy link
Contributor

oyo commented Nov 27, 2024

Description

Currently some longer running backend calls are implemented as synchronous calls in an unsafe way. More appropriate would be an asynchronous mechanism.

Acceptance Criteria

  • calls have been converted to async and use same semantic of separate invocations for create and read requests

Additional Information

Proposed async logic (Example: user)

Create:

POST /api/user
{
  "name": "myuser",
  "email": "[email protected]"
}
{
  "processId": "789",
  "status": "PENDING",
  "requestDate": 1732715777589
  "requestData": {
    "name": "myuser",
    "email": "[email protected]"
  }
}

Read:

GET /api/user/789
{
  "processId": "789",
  "status": "PENDING",
  "requestDate": 1732715777589,
  "requestData": {
    "name": "myuser",
    "email": "[email protected]"
  }
}
GET /api/user/123
{
  "processId": "123",
  "status": "SUCCESS",
  "requestDate": 1732715770000,
  "requestData": {
    "name": "someuser",
    "email": "[email protected]"
  },
  "resolveDate": 1732715771234
  "resolveData": {
    "id": "f81d4fae-7dec-11d0-a765-00a0c91e6bf6",
    "name": "someuser",
    "email": "[email protected]"
  }
}

List:

GET /api/users
[
  {
    "processId": "789",
    "status": "PENDING",
    "requestDate": 1732715777589,
    "requestData": {
      "name": "myuser",
      "email": "[email protected]"
    }
  },
  {
    "processId": "123",
    "status": "SUCCESS",
    "requestDate": 1732715770000,
    "requestData": {
      "name": "someuser",
      "email": "[email protected]"
    },
    "resolveDate": 1732715771234
    "resolveData": {
      "id": "f81d4fae-7dec-11d0-a765-00a0c91e6bf6",
      "name": "someuser",
      "email": "[email protected]"
    }
  },
  {
    "processId": "912",
    "status": "FAILURE",
    "requestDate": 1732715000000,
    "requestData": {
      "name": "thisuser",
      "email": "[email protected]"
    },
    "resolveDate": 1732715009999,
    "resolveData": {
      "code": "ITEM_CREATE_TIMEOUT",
      "message": "No response from keycloak server",
      "details": { ... }
    }
  }
]
@oyo oyo added the enhancement New feature or request label Nov 27, 2024
@github-project-automation github-project-automation bot moved this to NEW USER REQUEST in Portal Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: NEW USER REQUEST
Development

No branches or pull requests

1 participant