决与NHibernateSagaPersister的自动布线冲突

决与NHibernateSagaPersister的自动布线冲突

本文介绍了如何解决与NHibernateSagaPersister的自动布线冲突?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试连接我的第一个Saga,并且无法让接收端点正确处理启动消息。我得到以下异常:

I'm trying to wire up my first Saga, and have been unable to get the receiving endpoint to handle start message properly. I get the following exception:

我猜,内存持久性和NHibernateSagaPersister是冲突,但我不知道如何解决这个问题。我的配置是:

I'm guessing that both the in-memory persister and NHibernateSagaPersister are conflicting, but I can't figure out how to resolve this. My configuration is this:

public class SubscriberEndpointConfig : IWantCustomInitialization, IConfigureThisEndpoint
{
    public void Init()
    {
        _logger.Info("Subscriber is initializing..");

        Configure.With()
            .DefaultBuilder()
            .XmlSerializer()
            .MsmqTransport().IsTransactional(true).IsolationLevel(IsolationLevel.ReadCommitted).PurgeOnStartup(false)
            .UnicastBus().LoadMessageHandlers(First<GridInterceptingMessageHandler>.Then<SagaMessageHandler>())
            .Sagas()
            .NHibernateSagaPersister()
            .Log4Net();

    }
}



如果我删除LoadMessageHandlers ,错误消失,但当然我的处理程序从未调用。任何想法在这里错了什么?当我在生产配置文件中使用AsA_Server时,saga工作正常,没有自定义初始化,但是我需要使用它为其他原因。

If I remove the LoadMessageHandlers(), the error disappears but of course my handler is never invoked. Any ideas what's wrong here? The saga works properly when I am using AsA_Server in the production profile, without the custom initialization, but I need to use that for other reasons.

推荐答案

nservicebus配置文件正在为您配置持久性配置(http://www.nservicebus.com/Profiles.aspx)

The nservicebus profiles are configuring the persister for you(http://www.nservicebus.com/Profiles.aspx)

NServiceBus.Lite(默认)= InMemory

NServiceBus.Lite (default) = InMemory

NServiceBus.Integration = NHibernate + Sqlite

NServiceBus.Integration = NHibernate + Sqlite

NServiceBus.Production = NHibernate

NServiceBus.Production = NHibernate

所以在你的情况下,你可以删除对NHibernateSagaPersister()的调用,让配置文件工作。

So in your case you can remove the call to NHibernateSagaPersister() and let the profiles do it's work.

这篇关于如何解决与NHibernateSagaPersister的自动布线冲突?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-30 19:18