使用 Thin 作为 Web 服务器时从 Resque 工作线程访问 AMQP 连接
尝试解决使用 resque 作业处理入站 AMQP 消息时出现的问题。
我使用初始化程序在应用程序启动时设置消息使用者,然后将收到的消息提供给重新队列作业进行处理。效果很好。
但是,我还想处理来自工作线程的响应消息,即将其发布回队列,并且遇到了分叉进程的问题,使得应用程序范围的 AMQP 连接无法从 resque 工作线程内部寻址。我很想看看其他人如何解决这个问题,因为我不敢相信这种模式是不寻常的。
由于消息量的原因,采用为每个响应启动新线程和 amqp 连接的方法并不是一个可行的解决方案。
想法?
trying to work past an issue when using a resque job to process inbound AMQP messages.
am using an initializer to set up the message consumer at application startup and then feed the received messages to resque job for processing. that is working quite well.
however, i also want to process a response message out of the worker, i.e. publish it back out to a queue, and am running into the issue of the forking process making the app-wide AMQP connection unaddressable from inside the resque worker. would be very interested to see how other folks have tackled this as i can't believe this pattern is unusual.
due to message volumes, taking the approach of firing up a new thread and amqp connection for every response is not a workable solution.
ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我在这件事上失败了,我的注意力从球上移开,忘记了当它踢掉工人时的resque分叉。将采用其他人建议的守护进程的路线......
my bust on this, had my eye off the ball and forgot about resque forking when it kicks off a worker. going to go the route suggested by others of daemonizing the process instead....