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

Support services to decide responding asynchronously #2015

Open
GeraldKrause opened this issue Oct 23, 2024 · 2 comments · May be fixed by oasis-tcs/odata-vocabularies#284
Open

Support services to decide responding asynchronously #2015

GeraldKrause opened this issue Oct 23, 2024 · 2 comments · May be fixed by oasis-tcs/odata-vocabularies#284

Comments

@GeraldKrause
Copy link
Contributor

This issue complements the discussion in issue #1961 with a proposal to extend service capabilities for asynchronous processing with callbacks

Status Quo

The current specification supports asynchronous processing only if triggered by the client using preference respond-async (8.2.8.8 Preference respond-async). Moreover, the spec explicitly prohibits services to return status code 202 with a Location header if the request has not included the respond-async preference.

Extended Requirement

There are scenarios, however, where the service may want to decide on its own discretion to return the result asynchronously.

The reason could be at design-time, because the service implements query processing asynchronously, e.g. offload it to a task queue. More advanced implementations could decide at runtime for the given request to deviate from default synchronous processing, e.g. because the server load is currently high, the overall response time is estimated to be large, the logic to create the query result is complex. In such cases, the service would return a 202 with location response header, which is not allowed by the current spec.

Approach

A service that wants to respond to requests asynchronously exposes this behavior as a metadata annotation of a new term in the Capability vocabulary, e.g. Capabilities.AsynchronousRequestsObligatory. The scope could be expressed, i.e. for which type of requests, for which service resources.

Such an annotation would require a client to include the respond-async preference in every request in scope, otherwise the service rejects the request with a 404 status code. For the given request, the service decides if it is processed asynchronously, and returns the result in Preference-Applied accordingly.

@ralfhandl ralfhandl moved this to Open in OData TC Oct 23, 2024
@ralfhandl
Copy link
Contributor

No objection to the approach in general.

How to annotate this server behavior needs to be fleshed out.

@ralfhandl
Copy link
Contributor

ralfhandl commented Nov 20, 2024

Possible name for the capability

  • AsynchronousRequestsRequired - requests without Prefer: respond-async may be rejected

Services must also specify "Async...Supported" - document by making it the base term.

Should this be on container, on entity set, on operation, ...?

Maybe not a "capability" but a "requirement" or "enforcement"? No, we already have Restrictions in Capabilities.

@ralfhandl ralfhandl moved this from Open to Resolved in OData TC Nov 20, 2024
@ralfhandl ralfhandl moved this from Resolved to Review in OData TC Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Review
Development

Successfully merging a pull request may close this issue.

2 participants