Nservice总线处理程序触发问题 [英] Nservice Bus handler trigger issue

查看:103
本文介绍了Nservice总线处理程序触发问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

My project is upgrading to use nservice bus version 7. One of the handler is getting executed concurrently. After analysis found that there is a behavior code written and getting executed after handler election. Then next the handler will get executed.This will executed in loop and not getting ended.

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));
  }
}

上面是行为代码.不确定处理程序为什么要执行多次.

Above is the behavior code. Not sure why the handler getting executed multiple times.

推荐答案

这完全类似于此代码

public void Whatever()
{
  Whatever();
}

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

An endless loop. Just remove the Publish. Why did you add that line? Do you like duplicates? Because you posted the exact same question twice as well. Trying to create a recursive loop inside StackOverflow?

这篇关于Nservice总线处理程序触发问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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