.Net library has a Nack event method with this signature;
Task Nack(
PersistentSubscriptionNakEventAction action,
string reason,
params ResolvedEvent[] resolvedEvents)
With PersistentSubscriptionNakEventAction.Retry enum after 10 retries event is queued to parked stream.
The problem we are having is no matter what we send as the reason (in our case exception.Message) to Nack method’s second parameter, in the UI reason is always this; “Reached retry count of 10”
Is this by design? Is there a way to change link metada reason? Where does Nack method’s reason go (may be esdb’s own logs?)?
Is there any chance your event is actually timing out (10 seconds default I believe) so the default message is being written to the Link metadata?
We use the reason field, and it works.
Something that caught us out was batching events from a subscription.
Say you have 100 events, the 10 second timeout starts for all of those events (i.e. they don’t get 10 seconds each)
I could be wrong, but if you tried sending a single event on your subscription, and forced it to fail immediately, the message might change.
Hey Steven thanks for your time.
There is always a chance for timeout but our problem was different but you actually gave me a couple ideas to try which helped me a lot solving our problem =]
It turns out Nack method behaved different with PersistentSubscriptionNakEventAction Enum parameter. Only Park method was keeping and recording reason inside link metadata.
Something like this solved our problems;
if(retryCount < _persistentSubscriptionSettingsConfiguration.PersistentSubscriptionSettings.MaxRetryCount)
await persistentSubscription
.Nack(PersistentSubscriptionNakEventAction.Retry, exceptionMessage, resolvedEvent);
else
await persistentSubscription
.Nack(PersistentSubscriptionNakEventAction.Park, exceptionMessage, resolvedEvent);
Glad you got the problem resolved.