RawRabbit.Pipe 命名空间

RawRabbit.Pipe NameSpace

我正在尝试掌握 ServiceBus 架构,我正在使用 RawRabbit 1.10.4。 为此,我正在学习使用 RawRabbit 的在线课程。 在命令处理程序的注册中,创建了以下扩展方法,其中调用了 Methoc ctx.UseConsumerConfiguration。

扩展方法应该在 RawRabbit.Pipe 命名空间中,该命名空间不可用。 我需要安装什么 nuget 包以获取扩展方法,或者此扩展方法/命名空间是否已在版本 1.10.4 中删除?

    public static class Extensions
{
    public static Task WithCommandHandlerAsync<TCommand>(this IBusClient bus,
        ICommandHandler<TCommand> handler)
        where TCommand : ICommand
    => bus.SubscribeAsync<TCommand>(msg => handler.HandleAsync(msg),
        ctx => ctx.UseConsumerConfiguration(cfg => cfg.FromDelaredQueue(q => q.WithName("XXX"))));
}

我认为你需要安装RawRabbit 2.0,而Nuget Manager Package中的最新版本只有1.10.4什么的。 但是,您可以使用程序包管理器控制台使用以下语法安装版本 2

Install-Package RawRabbit -Version 2.0.0-beta9

希望对您有所帮助

实际上你必须安装 nuget 包 RawRabbit.Compatibility.Legacy 然后引用到您的 class 命名空间 RawRabbit.Compatibility.Legacy 或者安装包 RawRabbit.Operations.Subscribe 如果你不想使用遗留代码

使用UseSubscribeConfiguration代替UseConsumerConfiguration

在 "Add Packages" 对话框中有一个 "Show pre-release packages" 复选框,您可以勾选它,因此 "Version" 组合框也会显示 beta 和 rc 版本。