NServiceBus翻译之持久化技术(一):Persistence In NServiceBus

Last Updated: Dec 03, 2012 08:24PM IST

NserviceBus中有很多特征都要求信息的持久化,主要是timeouts,Sagas,以及subscription的存储。

NserviceBus中有四种持久化技术:

1.      RavenDB

2.      NHibernate

3.      In Memory

4.      MSMQ

关于RavenDB的安装可以看 here and怎么样连接到RavenDB参见 here.

Using NHibernate for persistence

NserviceBus3.0开始支持NHibernate持久化技术,其位于单独的程序集中,更多信息参加 Readmore

What's available?

下表总结了哪些是可以获得的,以及如何配置他们:

 

InMemory

RavenDB

NHibernate

MSMQ

Timeout

Not supported begining version 3.3,0

Subscription

Saga

 

Gateway

 

Distributor

 

 

Second Level Retry

 

 

 

Fault Management

 

 

Notifications

 

 

 

假如self hosting,那么你可以根据你的需求任意配置持久化技术,举一个例子,假如你想要存储subscription在内存中,timeouts在RavenDB中,那么可以使用以下代码:

static void Main()
{
    Configure.With()
        .Log4Net()
        .DefaultBuilder()
        .XmlSerializer()
        .MsmqTransport()
            .IsTransactional(true)
            .PurgeOnStartup(false)
           .InMemorySubscriptionStorage()
        .UnicastBus()
            .ImpersonateSender(false)
            .LoadMessageHandlers()
        .UseRavenTimeoutPersister()
        .CreateBus()
        .Start(() =>
            Configure.Instance.
               ForInstallationOn<NServiceBus.
                   Installation.Environments.Windows>().Install());
}

当使用NServiceBus.Host.exe,有现成的profile你可以利用,下表展示了每种预建profile的默认配置采用的是何种持久化技术。 此外,你可以覆盖这些默认的配置,如何覆盖参考

here and here.

下表总结了应用在内建的profile中的不同的持久化技术,不过在配置一个持久化技术之前首先检查一下是否有别的存储被使用,以避免覆盖了用户的配置。

 

InMemory

RavenDB

NHibernate

MSMQ

Timeout

Lite

Integration/Production

 

Keeps a queue for management

Subscription

Lite

Integration/Production

 

 

Saga

Lite

Integration/Production

 

 

Gateway

Lite

MultiSite

 

 

Distributor

 

 

 

Distributor

Second Level Retry

 

 

 

Uses Timeout queue

Fault Management

Lite

 

 

Integration/Production

Notifications

 

 

 

Lite/Integration/Production

Default Persisting Technology

AsA_Server将会激活Timeout manager,这个角色并不明确决定使用哪种持久化技术,默认的timeout manager的持久化技术是RavenDB。

类似于AsA_Server这个角色,不同的profile将会激活不同的NServiceBus特征,而不需要明确地配置持久化技术,更多的关于各种profile的资料参考 here.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值