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

Improve Service Callback orchestration in REST API #4

Open
Alfiva opened this issue Feb 23, 2017 · 0 comments
Open

Improve Service Callback orchestration in REST API #4

Alfiva opened this issue Feb 23, 2017 · 0 comments

Comments

@Alfiva
Copy link
Member

Alfiva commented Feb 23, 2017

Because of thread locks, right now the REST API follows this flow when handling service calls from server to endpoint:

  1. ServiceRequest received at REST API replica of endpoint
  2. REST API sends POST to callback URL of endpoint
  3. Endpoint send HTTP OK
  4. REST API waits for POST with ServiceResponse
  5. Endpoint sends POST to REST API with ServiceResponse
  6. REST API relays the ServiceResponse to the original caller

The thing is that 3 must strictly happen before 4, because REST API will block until 3 before proceeding with 4. This means that endpoint clients must be careful not send the ServiceResponse before the HTTP OK is first delivered. Otherwise, the ServiceResponse may not be processed until the REST API timeout ellapses (30 seconds by default).

Those steps should be best practice, but anyway, it would be a good idea to rewrite a bit the way the REST API deals with thread locks to avoid the 30 second delay even if worse case scenarios.

Another enhancement for this would be allowing endpoints to respond "synchronously", by sending the serialized ServiceResponse within the HTTP OK, and then REST API does not need to wait.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants