在 ServiceMatrix 中,是否可以 'ConvertToSaga' 端点 publishes/subscribes 事件消息而不是命令消息?
In ServiceMatrix, is it possible to 'ConvertToSaga' an endpoint which publishes/subscribes event messages rather than command messages?
我有一个包含 4 个 NSB 主机端点的解决方案,这些端点是使用 ServiceMatrix 创建的,我想在 saga 中使用它们。
我知道如何从命令转换为 Saga,并且在测试项目中工作正常。我不明白的是我如何对已发布的事件做同样的事情,因为菜单选项不可用。是否可以使用 ServiceMatrix 来做到这一点?
我尝试通过遵循 this tutorial 并观察在我 Converted To Saga 时对我的测试项目所做的更改来手动实施更改。
构建正常,但在 运行:
时在框架内抛出错误
System.InvalidOperationException was unhandled
Message: An unhandled exception of type 'System.InvalidOperationException' occurred in mscorlib.dll
Additional information: No IBus instance available, please configure one and also verify that you're not defining your own Bus property in your saga since that hides the one in the base class
我正在使用 VS2013 和 ServiceBus 5。
更新:
我从生成的代码中注释掉了继承的 IHandleMessages<> 接口和 public IBus Bus 属性,它运行时没有出现此错误。我不喜欢这样做,因为使用该工具进行的下一次设计更改将覆盖这些修复。
在您的命令处理程序中,您通常有一个 属性 类型的 IBus,它通过 属性 注入或构造函数注入注入到处理程序 class。
当您从命令处理程序移动到 Saga 时,您需要从处理程序中删除 IBus 属性。 Saga 基地 class 有一个 Bus 属性,您应该改用它。这个 属性 是自动为你填充的,你不应该关心这个。这正是此异常告诉您的内容。
我有一个包含 4 个 NSB 主机端点的解决方案,这些端点是使用 ServiceMatrix 创建的,我想在 saga 中使用它们。
我知道如何从命令转换为 Saga,并且在测试项目中工作正常。我不明白的是我如何对已发布的事件做同样的事情,因为菜单选项不可用。是否可以使用 ServiceMatrix 来做到这一点?
我尝试通过遵循 this tutorial 并观察在我 Converted To Saga 时对我的测试项目所做的更改来手动实施更改。
构建正常,但在 运行:
时在框架内抛出错误System.InvalidOperationException was unhandled Message: An unhandled exception of type 'System.InvalidOperationException' occurred in mscorlib.dll
Additional information: No IBus instance available, please configure one and also verify that you're not defining your own Bus property in your saga since that hides the one in the base class
我正在使用 VS2013 和 ServiceBus 5。
更新: 我从生成的代码中注释掉了继承的 IHandleMessages<> 接口和 public IBus Bus 属性,它运行时没有出现此错误。我不喜欢这样做,因为使用该工具进行的下一次设计更改将覆盖这些修复。
在您的命令处理程序中,您通常有一个 属性 类型的 IBus,它通过 属性 注入或构造函数注入注入到处理程序 class。
当您从命令处理程序移动到 Saga 时,您需要从处理程序中删除 IBus 属性。 Saga 基地 class 有一个 Bus 属性,您应该改用它。这个 属性 是自动为你填充的,你不应该关心这个。这正是此异常告诉您的内容。