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

Asynchronous processing #244

Closed
wants to merge 4 commits into from
Closed

Asynchronous processing #244

wants to merge 4 commits into from

Conversation

sharpner
Copy link
Member

TODOs:

  • Nice handling of url creation
  • Find a clean solution to handle subtrees e.g. /jobs/queues/1 like in the spec

@sharpner sharpner added the WIP label Feb 25, 2016
@sharpner
Copy link
Member Author

So I kinda got this to work, but the tricky part is now the correct handling.
The actual flow of asynch operations would be:

POST /photos

Create gets called, but it does not create a photo, instead it creates a temporary handle. In the example
it creates /photos/queue-jobs/5234 that only contains a "status" attribute.
Optionally you get a Content-Location Header with the optional full resource identifier.

GET /photos/queue-jobs/5234

This call will return 303 See Other when its done. Additionally it contains a Location Header back to the actual Photo that got created. E.g. Location: https://example.com/photos/4577
No documentation as to what is if the process is not yet finished.

IMHO api2go does not yet have the functionality to implement such an behaviour. A user can probably fake it after this PR gets merged (without the optional location header) but to implement the suggestion 1:1 we would need a way to respond to Create differently than either Succeed or Error.

What do you think @wwwdata?

@sharpner
Copy link
Member Author

RFC for #243

@wwwdata
Copy link
Member

wwwdata commented Feb 29, 2016

so far this looks good in my opinion

@sharpner
Copy link
Member Author

sharpner commented Mar 3, 2016

so we are going to merge this for now?

@wwwdata
Copy link
Member

wwwdata commented Mar 4, 2016

It cannot hurt to merge it but we should mention something about it in the Readme as well

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

Successfully merging this pull request may close these issues.

2 participants