RavenDB Saga Persister没有坚持saga实体

时间:2012-03-22 18:32:57

标签: nservicebus ravendb

我们正在使用RavenDB传奇存储,但是在启动消息处理程序之后,saga数据没有被持久化。我只在数据库中看到一些订阅文档。我不确定接下来要检查什么。想法?

我有一个传奇:

public class BuyerWaitingOnDocumentsDistributor :
    Saga<BuyerDocumentDistributorData>,
    IAmStartedByMessages<DocumentVersionRequiresBuyerSignature>
{
    public void Handle(DocumentVersionRequiresEmployeeSignature message)
    {
        Data.DocumentVersionId = message.DocumentVersionId.Value;
        // Business logic goes here
    }

    // Other handlers & methods here
}

和saga实体:

public class BuyerDocumentDistributorData : IContainSagaData
{
    public virtual Guid Id { get; set; }
    public virtual string Originator { get; set; }
    public virtual string OriginalMessageId { get; set; }

    public virtual Guid DocumentVersionId { get; set; }
    public virtual EmployeeId[] AuthorizedToSign { get; set; }
}

和saga finder:

    public class BuyerWaitingOnDocumentsDistributorSagaFinder : 
        IFindSagas<BuyerDocumentDistributorData>.Using<DocumentVersionRequiresBuyerSignature>,
        IFindSagas<BuyerDocumentDistributorData>.Using<DocumentVersionSignedByBuyer>,
        IFindSagas<BuyerDocumentDistributorData>.Using<DocumentVersionNoLongerRequiresSignature>
    {

        private static readonly ILog Log = LogManager.GetLogger(typeof (BuyerWaitingOnDocumentsDistributorSagaFinder));

        public ISagaPersister Persister { get; set; }

        public BuyerDocumentDistributorData FindBy(DocumentVersionRequiresBuyerSignature message)
        {
            return Persister.Get<BuyerDocumentDistributorData>("DocumentVersionId", message.DocumentVersionId.Value);
        }

        public BuyerDocumentDistributorData FindBy(DocumentVersionSignedByBuyer message)
        {
            return Persister.Get<BuyerDocumentDistributorData>("DocumentVersionId", message.DocumentVersionId.Value);
        }

        public BuyerDocumentDistributorData FindBy(DocumentVersionNoLongerRequiresSignature message)
        {
            return Persister.Get<BuyerDocumentDistributorData>("DocumentVersionId", message.DocumentVersionId.Value);
        }
    }

我也在NServiceBus Yahoo组上提出了这个问题:http://tech.groups.yahoo.com/group/nservicebus/message/13265

1 个答案:

答案 0 :(得分:0)

你没有给出你的endpointconfig,所以我不确定你正在使用哪个容器。

使用NinjectBuilder时,我们遇到同样的问题(saga没有被持久化)。使用DefaultBuilder可以正常工作。