doupang1917 2016-12-19 10:30
浏览 54

RabbitMq消息间通信

I am using RabbitMq with AMQP and Symfony2.

I have an issue where I have multiple workers and when I get multiple messages from the same type queued, they are picked up by the consumers and they start working on the same Entity and overwrite each other's data (the same consumer gets executed on 2 or more workers at that point).

I have tried setting a property on the Entity when the first message starts, so when some other comes and checks against it it re-queues the message if the Entity is in use but this still doesn't fix the problem as the DB query is slower than the time it takes to consume the messages.

Is there a way the messages can communicate between each other or set flags somehow in the RabbitMq maybe so that another message can check against that so I avoid this parallel consumer execution on the same Entity?

Thank you

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 孟德尔随机化结果不一致
    • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
    • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
    • ¥15 谁有desed数据集呀
    • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
    • ¥15 关于#hadoop#的问题
    • ¥15 (标签-Python|关键词-socket)
    • ¥15 keil里为什么main.c定义的函数在it.c调用不了
    • ¥50 切换TabTip键盘的输入法
    • ¥15 可否在不同线程中调用封装数据库操作的类