Nservice总线处理程序触发器问题

问题描述 投票:0回答:1

我的项目正在升级以使用nservice总线版本7。其中一个处理程序正在同时执行。经过分析发现,在选择处理程序后有行为代码被编写并被执行。接下来处理程序将被执行,这将循环执行而不结束。

public class GatewayPublishBehavior : Behavior<IIncomingLogicalMessageContext>
{

  public override async Task Invoke(IIncomingLogicalMessageContext context, Func<Task> next)
  {
    //// custom logic before calling the next step in the pipeline.
    await next().ConfigureAwait(false); 
    // custom logic after all inner steps in the pipeline completed.
    await context.Publish(context.Message.Instance, 
  this.RetrieveAndGetSendOptions(context));
  }
}

以上是行为代码。不知道为什么处理程序会多次执行。

c# asp.net .net nservicebus
1个回答
0
投票

完全类似于此代码

public void Whatever()
{
  Whatever();
}

无限循环。只需删除发布。为什么要添加那条线?你喜欢重复吗?因为您也发布了完全相同的问题两次。试图在StackOverflow内部创建递归循环?

© www.soinside.com 2019 - 2024. All rights reserved.