Domanda

Using JOliver EventStore 3.0 and reciving commands from NServiceBus, what's the proper way to handle concurrency exceptions? If I have more than one worker thread, this could be a common occurance.

Option 1

try
{
    // store the event
    ...
}
catch (ConcurrencyException)
{
    _bus.HandleCurrentMessageLater();
}

Option 2

Let it throw back to NServiceBus and get retried with the MsMqTransportConfig.MaxRetries option from the config.

Option 3

Something I'm not thinking of?

È stato utile?

Soluzione

You could compare the uncommitted events with the committed events and see if they actually conflict (according to your business rules) - if there's no conflicts then you can allow the events to be persisted, otherwise re-throw.

Generally though I just let it throw and have NServiceBus retry.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top