Rails:如何在事件触发之前没有响应
不知道Rails有没有办法做到如下:
- 接收请求
- 将请求放入监听列表,直到有事件触发
- 完成请求但不向客户端返回任何响应(无HTTP响应),触发器将处理后稍后进行响应。
我找到了一些有关delayed_job的信息,但它立即返回响应并将作业置于后台,这似乎不是事件驱动的。
有人可以帮忙吗?
安迪.
I don't know if Rails has a way to do as following:
- Receive a request
- Put the request into the monitor list until an event triggers
- 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为你在谈论回调。请阅读此处:API。请注意,您也可以创建自定义事件和回调:博客< /a>
I think you are talking about callbacks. Read here: API. Note that you can create custom events and callbacks too: blog
您可能正在寻找通知、观察者,和/或 COMET
You're probably looking for Notifications, Observers, and/or COMET