My understanding is that expectedVersion.Any should never fail with a WrongExpectedVersion because all idempotency checks are off as listed in http://docs.geteventstore.com/dotnet-api/3.0.3/optimistic-concurrency-and-idempotence/ where it says “This disables the optimistic concurrency check.”
Yet occassionally we’ll see an error like:
Message with id
6d4a4a40-83b6-5f2c-999a-8e462631ab59 found in position 513 in stream
Xi::IntegrationContainerReceived failed with reason Append failed due to
WrongExpectedVersion. Stream:
Xi::MidAmericanIL-ReceivedPackage_4fd7e767c9b85b5c8de8fefb8769b9c9, Expected
version: -2.
Stack trace is:
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean
includeTaskCanceledExceptions) at System.Threading.Tasks.Task.Wait(Int32
millisecondsTimeout, CancellationToken cancellationToken) at
System.Threading.Tasks.Task.Wait() at
Realgy.ExternalIntegration.Infrastructure.Aggregate.EventStore.Repository1.SaveAll(Guid origEventId, String srvcName, Dictionary
2 metaData) at
Realgy.ExternalIntegration.Infrastructure.Aggregate.EventStore.Repository1.SaveAll(ResolvedEvent origEvent, String srvcName) at Realgy.ExternalIntegration.Partner.ILEdiCommon.Handlers.BaseDecontainerService
1.WorkMethod(IntegrationContainerReceived
srcEvent, HandleEventsContext ctx) at
Realgy.ExternalIntegration.Infrastructure.Reactive.Host.EventStoreIHandleWrapper1.onNextWorkAction(ResolvedEvent req, IEventStoreConnection esConn) in c:\Builds\2\RealgyFirst\XiProduction\src\RealgyFirst\Xi\Production\Infrastructure\Rx\ReactiveHost\EventStoreIHandleWrapper.cs:line 26 at Realgy.ExternalIntegration.Infrastructure.EventStore.RxExtensions.EventStoreObserver
1.OnNext(ResolvedEvent
srcEvent) in c:\Builds\2\RealgyFirst\XiProduction\src\RealgyFirst\Xi\Production\Infrastructure\EventStore\EventStoreReactive\EventStoreObserver.cs:line
62 at
Realgy.ExternalIntegration.Infrastructure.EventStore.RxExtensions.EventStoreObserverWithExceptionCatch.OnNext(ResolvedEvent
srcEvent) in c:\Builds\2\RealgyFirst\XiProduction\src\RealgyFirst\Xi\Production\Infrastructure\EventStore\EventStoreReactive\EventStoreObserverWithExceptionCatch.cs:line
25
looking at the stream all the events appear to be written at the same time (and we do not have any retry logic).
Can you help me understand what I’m missing?