tags:

views:

22

answers:

0

I'm trying to get a simple saga working so that I can handle messages during the day, then on certain criteria, set a timeout to finish processing certain messages at midnight. I've followed a couple examples to set this up. here and here.

Here is configuration from the EndpointConfig.cs

     Kernel = new StandardKernel(
        new RepositoryModule(),
        new DeliveryModule(),
        new ConfigurationModule(),
        new NHibernateModule()
        );

     AutoMapperConfiguration.Configure( Kernel );

     SetLoggingLibrary.Log4Net( log4net.Config.XmlConfigurator.Configure );

     Configure.With()
        .NinjectBuilder( Kernel )
        .MsmqSubscriptionStorage()
        .XmlSerializer()
        .Sagas()
        .NHibernateSagaPersisterWithSQLiteAndAutomaticSchemaGeneration()
        .MsmqTransport()
           .IsTransactional( true )
           .PurgeOnStartup( false )
        .UnicastBus()
           .ImpersonateSender( false )
           .LoadMessageHandlers()
        .CreateBus()
        .Start();

The app.config:

  <!-- Server's input queue -->
  <MsmqSubscriptionStorageConfig
    Queue="nservicebus_subscriptions"
  />

  <!-- Client's input queue -->
  <MsmqTransportConfig
    InputQueue="fd_deliveryinput"
    ErrorQueue="fd_deliveryerror"
    NumberOfWorkerThreads="1"
    MaxRetries="5"
  />

  <!-- Define endpoint -->
  <UnicastBusConfig>
    <MessageEndpointMappings>
      <add Messages="FD.WorksiteServices" Endpoint="fd_publisherinput" />
      <add Messages="NServiceBus.Saga.TimeoutMessage, NServiceBus" Endpoint="timeoutmanager" />
    </MessageEndpointMappings>
  </UnicastBusConfig>

And I have the supplied timeout manager service running. Every time the service appears to begin to respond to a message, I get the following error:

2010-10-05 16:42:39,392 [Worker.6] ERROR NServiceBus.Unicast.UnicastBus [(null)] <(null)> - SagaMessageHandler Failed handling message.
Ninject.ActivationException: Error activating ISagaPersister
More than one matching bindings are available.
Activation path:
  2) Injection of dependency ISagaPersister into property Persister of type SagaMessageHandler
  1) Request for SagaMessageHandler

Suggestions:
  1) Ensure that you have defined a binding for ISagaPersister only once.

I can't seem to find any clue as to where to go from here. I'm not sure Ninject thinks there is more than one registered binding. That said, I'm a Ninject neophyte.

Has anyone else seen this error have some ideas on what to try?

Thanks

UPDATE:

I got this working, but I didn't answer my question. For anyone looking to at this to see Saga's work, I'll share what I did.

  1. Removed the following line from the EndpointConfig.cs

    .NHibernateSagaPersisterWithSQLiteAndAutomaticSchemaGeneration()

That allowed the process to run, but I then started getting a null reference exception when I called RequestTimeout.

  1. I fixed that by realizing that my Saga was injecting an IBus, which is unneeded as the base Saga already injects one.

This was started this as a message handler then the need for timeouts came into play, hence the prior need for the IBus.

Like I said, not an "answer" but it's (hopefully) something for someone.