doumor942473 2015-04-27 18:25
浏览 56
已采纳

使用rabbitmq实现作业队列

I have built a rabbitmq wrapper which publishes messages to consumers and this is working well.

Can I also build a work queue (like gearman) in rabbitmq which can distribute long running tasks to consumers and the consumers, in turn, notify the publisher with the results.

I guess this would require the publisher to act as a consumer as well which I am not sure how to implement. (Please correct me if I am wrong).

Or, is rabbitmq just not the tool for such case.

Thanks,

  • 写回答

1条回答 默认 最新

  • dongliang_bj2016 2015-04-27 19:03
    关注

    RabbitMQ supports this type of pattern. Have a look at the RPC tutorial for a bootstrap of how to implement this pattern.

    It can be implemented in different way depending of your needs:

    • direct reply queue, queue will be created and used only for the reply associated to the request
    • static reply queue which will contain all the replies

    It usually implies a correlation id to correlate request with the reply, or it can be stateless if the reply contains all the necessary information.

    It really depends on your needs.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog