Open chrismckinnel opened 11 years ago
Hey.
I'm afraid I don't have any experience with this. If you figure out something that you feel may be useful to others, I'd be happy to add it to the documentation.
Can you be more specific about the problem you're having? This is just a shot in the dark, but perhaps it would be solved or mitigated by issue #82, which suggests preprocessor
and postprocessor
hooks for each of the HTTP methods?
Hey Jeffrey, thanks for your reply.
I was thinking along the lines of if the client that is consuming the API expects to be told whether or not a POST, PUT, PATCH or DELETE request was successful, at the moment the client is forced to wait until whatever operation the API is performing is complete.
If the API is experiencing any issues (database connectivity, high load, expensive tasks, etc) then the client would hang until some time-out was reached or be delayed until the task was completed. If we could make the task the API performs asynchronous, we could immediately send a response like "your request was successful and has been added to the queue" while the task is being completed in our own sweet time elsewhere.
As it turns out, for the current project I'm using your flask-restless extension on doesn't require this functionality quite yet, it was just a thought I had.
Hmm, interesting. Although I believe this is a valuable request in theory which would prove useful to people, it would probably require a hefty change to the code, introducing another layer behind the API
class which distributes requests using whichever asynchronous task library the user prefers, along with some sort of machinery to send out task completion notifications.
I don't have the time (or know-how) to make those kind of changes myself, so I'm going to mark this as wontfix
for now. However, I am of course willing to consider more proposals and/or code changes along this line of inquiry, and I will leave this issue open.
On the master branch, Flask-Restless now implements JSON API. The JSON API authors have obviously thought of this, since they allow a POST request to cause a 202 response; see http://jsonapi.org/format/#crud-creating-responses-202.
Hi Jeffrey,
I'm looking to make calls to my flask-restless API asynchronous using something like Celery and Rabbit-MQ. Have you looked into doing this before or would you have any recommendations on how I would go about doing it?
At the moment I can't see past having to override your post() view, but I'm not quite sure how to go about doing that.
Any ideas would be much appreciated!
Thanks Chris