Rails: How to have no response until an event triggers

十年热恋 提交于 2019-12-12 01:48:09

问题


I don't know if Rails has a way to do as following:

  1. Receive a request
  2. Put the request into the monitor list until an event triggers
  3. Finish the request but does not return any response to the client (no HTTP response), the trigger will do the response later after processing.

I found some info about delayed_job, but it returns the response immediately and puts the job to the background which does not seem to be event-driven.

Anyone can help?

Andy.


回答1:


I think you are talking about callbacks. Read here: API. Note that you can create custom events and callbacks too: blog




回答2:


You're probably looking for Notifications, Observers, and/or COMET



来源:https://stackoverflow.com/questions/6972393/rails-how-to-have-no-response-until-an-event-triggers

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!