NServiceBus-安装

NServiceBus已安装程序的概念,以确保端点特定具体的文物如。、队列、文件夹或数据库安装和配置自动为您如果需要在安装时。

创建您自己的安装程序一样容易实现 INeedToInstallSomething<T>接口。

版本3和4只
public interface INeedToInstallSomething<T> : INeedToInstallSomething where T : IEnvironment
{
    void Install(string identity);
}
所有版本

通用参数给你限制你的安装程序到一个特定的平台。目前这是或Windows Azure。

如果你不关心运行时环境,只是使用 INeedToInstallSomething接口。

public interface INeedToInstallSomething
{
    void Install(string identity);
}

NServiceBus扫描组件在运行时目录安装,这样你就不需要任何代码注册它们。

只有3.0版本:版本3.0提供了一个接口 INeedToInstallInfrastructure<T>接口。它主要是用于事情并不特定于给定端点。,RavenDB或MSMQ。这个接口已经弃用在版本4.0和5.0将被删除,因为的引入powershell commandlets援助基础设施的安装。

当它们调用吗?

使用NServiceBus主机时,调用安装如图所示:

命令行参数
基础设施(v3.0)安装
常规安装程序

/安装NServiceBus.Production

NServiceBus.Production

/安装NServiceBus.Integration

NServiceBus.Integration

/安装NServiceBus.Lite

NServiceBus.Lite

安装程序是由两个控制 /install命令行选项和主机使用的电流分布。当然,您可以实现您自己的配置文件,如果你有其他需求。

当自我托管NServiceBus、手动调用安装使用:

  • v5
  • V4

    编辑

    var configuration = new BusConfiguration();
    
    configuration.EnableInstallers();
    
    Bus.Create(configuration);//this will run the installers
    

    的使用 /installInfrastructure国旗的 NServiceBus.Host已弃用4.0版。安装所需的基础设施,使用powershell commandlets来代替。

  • 原文地址:https://www.cnblogs.com/powerxu/p/4294320.html