仅使用 rails api 模式的 resque-web

问题描述:

1.将 resque-web 与仅 Rails API 模式一起使用的最佳方法是什么?

我的应用程序使用 resque 和四个独立的作业服务器来运行队列.我已经安装了 resque-web 并在本地机器上运行它.它工作正常,只是向我显示有关工作人员和队列的信息.然而,如果我尝试重试失败"的作业或删除队列",它会给我路由错误.

My application uses resque with four separate job servers fur running the queues. I have mounted resque-web and I run it on local machine. it works fine only to show me the information about workers and queues. However, if I try to 'retry failed' jobs or 'delete a queue', it gives me routing error.

2.有没有现成的方法将 resque-web 使用的所有路由公开为 json API?

这样我就可以设计自己的 JS 前端用于作业监控

So that I can design my own JS front end for job monitoring

在 Rails仅限 API"的应用程序中,您可以通过将这些行添加到 application.properties 来修复重试失败的作业或删除队列时的路由错误.rb:

In an Rails "API-only" app, you can fix the routing errors when retrying failed jobs or deleting queues by adding these lines to application.rb:

config.middleware.use Rack::MethodOverride
config.middleware.use ActionDispatch::Flash

有关详细信息,请参阅此 GitHub 问题.

See this GitHub issue for more details.