Celery include a module that is able to make asynchronous HTTP requests using amqp or some other celery backend. I am using tornado-celery producer for asynchronous message publishing. As I understood tornado-celery uses pika for this. The question is how to adapt celery.task.http.URL for tornado (make it non-blocking). There are basically two places, which have to be refined:
HttpDispatch.make_request()
have to be implemented using tornado async http client;URL.get_async(**kw)
orURL.post_async(**kw)
must be reimplemented with corresponding non-blocking code using tornado API. For instance:class NonBlockingURL(celery.task.http.URL): @gen.coroutine def post_async(self, **kwargs): async_res = yield gen.Task(self.dispatcher.delay, str(self), 'POST', **kwargs) raise gen.Return(async_res)
But I could not understand how to do it in proper and concise way. How to make it fully as non-blocking as asynchronous ? By the way, I am using amqp backend.
Please, provide me nice guideline or even better, an example.