我的项目正在升级以使用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));
}
}
以上是行为代码。不知道为什么处理程序会多次执行。
完全类似于此代码
public void Whatever()
{
Whatever();
}
无限循环。只需删除发布。为什么要添加那条线?你喜欢重复吗?因为您也发布了完全相同的问题两次。试图在StackOverflow内部创建递归循环?