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 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用
  • ¥15 C++ yoloV5改写遇到的问题
  • ¥20 win11修改中文用户名路径
  • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
  • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
  • ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题
  • ¥15 帮我写一个c++工程
  • ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法
  • ¥15 关于smbclient 库的使用