`
jiq408694711
  • 浏览: 33647 次
  • 性别: Icon_minigender_1
  • 来自: 南京
文章分类
社区版块
存档分类
最新评论

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的安装可以看hereand怎么样连接到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的默认配置采用的是何种持久化技术。 此外,你可以覆盖这些默认的配置,如何覆盖参考

hereandhere.

下表总结了应用在内建的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.

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics