为什么我在跳过的队列中收到消息 [英] Why am I getting messages in the skipped queue

查看:72
本文介绍了为什么我在跳过的队列中收到消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在fork/join配置中有一个传奇设置.

I have a saga setup in a fork/join configuration.

  • FileMetadataMsg
  • FileReadyMsg
  • SomeOtherMsg
  • FileMetadataMsg
  • FileReadyMsg
  • SomeOtherMsg
  • 发布SagaStart(correlationId)
  • 发布FileSavedToMsg(correlationId, fileLoc)
  • 发布FileMetadataMsg(correlationId, metadata)
  • 发布FileReadyMsg(correlationId, fileLoc)
  • Publishes SagaStart(correlationId)
  • Publishes FileSavedToMsg(correlationId, fileLoc)
  • Publishes FileMetadataMsg(correlationId, metadata)
  • Publishes FileReadyMsg(correlationId, fileLoc)

Consumer<FileSavedToMsg>

  • 发布SomeOtherMsg(GotTheFileMsg.correlationId, data)

我在saga_skipped队列中得到了FileSavedToMsg.我只能认为这是由于FileSavedToMsg上具有relatedId所致,因为传奇本身并未在其状态机中使用FileSavedToMsg且没有Event<FileSavedToMsg>.

I am getting a FileSavedToMsg in the saga_skipped queue. I can only assume it's due to having a correlationId on the FileSavedToMsg because the saga itself is not using FileSavedToMsg in its state machine and does not have an Event<FileSavedToMsg>.

如果这是为什么...我应该在CorrelationId以外的其他字段中传递correlationId,那么传奇看不到它吗?我在某处需要它,因此可以用它标记SomeOtherMsg.

If this is the reason why...should I be passing the correlationId along in a field other than the CorrelationId, so the saga doesn't see it? I need it somewhere so I can tag SomeOtherMsg with it.

这里是英雄传奇端点的定义方式

Here is how the saga endpoint is defined

return Bus.Factory.CreateUsingRabbitMq(cfg =>
{
    var host = cfg.Host(new Uri("rabbitmq://localhost/"), h =>
            {
                h.Username("guest");
                h.Password("guest");
            });              

            cfg.ReceiveEndpoint(host, "study_saga", epCfg =>
            {
                epCfg.StateMachineSaga(machine, repository);
            });
});

这是工作程序端点的定义方式

Here is how the worker endpoint is defined

return Bus.Factory.CreateUsingRabbitMq(x =>
{
    var host = x.Host(new Uri("rabbitmq://localhost/"), h =>
        {
            h.Username("guest");
            h.Password("guest");
        });

        x.ReceiveEndpoint(host, "study_3d_volume_worker", c =>
        {
            c.PrefetchCount = 1;
            c.Instance(_studyCreatedMsgConsumer);
        });
 });

它们在同一台计算机上运行,​​但是在单独的控制台/Topshelf应用程序中.

These are running on the same machine, but in seperate Console/Topshelf applications.

推荐答案

如果您正在队列中获取未被该接收端点上的使用者使用的消息,则可能是您先前正在使用该消息类型,并且从使用者(或传奇)中删除了它,或者您出于其他目的使用队列,并且消耗了该消息类型.

If you are getting messages on a queue that are not consumed by a consumer on that receive endpoint, it might be that you either previously were consuming that message type and removed it from the consumer (or saga, in your case) or you were using the queue from some other purpose and it consumed that message type.

无论哪种方式,如果您进入RabbitMQ管理控制台并查找队列,则可以展开绑定"字形,单击以转到具有相同名称的交换(这是标准的MassTransit约定),然后展开绑定交换以查看哪些消息类型(命名为.NET类型名称的交换)绑定到该交换.

Either way, if you go into the RabbitMQ management console and look for the queue, you can expand the Bindings chevron, click to go to the exchange of the same name (that's a standard MassTransit convention), and then expand the bindings of the exchange to see which message types (the exchanges named like .NET type names) are bound to that exchange.

如果看到端点未消耗的那一个,那就是罪魁祸首.您可以使用用户界面取消绑定,此后发布的消息将不再发送到队列.

If you see one that is not consumed by the endpoint, that's the culprit. You can Unbind it using the UI, after which messages published will no longer be sent to the queue.

这篇关于为什么我在跳过的队列中收到消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆