Skip to content

Commit b401c45

Browse files
committed
Support ACKing just the eventid instead of the whole ResolvedEvent
1 parent 463e932 commit b401c45

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

src/EventStore.ClientAPI.NetCore/EventStorePersistentSubscriptionBase.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,27 @@ public void Acknowledge(IEnumerable<ResolvedEvent> events)
104104
_subscription.NotifyEventsProcessed(ids);
105105
}
106106

107+
/// <summary>
108+
/// Acknowledge a message by event id (this will tell the server it has been processed)
109+
/// </summary>
110+
/// <remarks>There is no need to ack a message if you have Auto Ack enabled</remarks>
111+
/// <param name="eventId">The <see cref="ResolvedEvent"></see> OriginalEvent.EventId to acknowledge</param>
112+
public void Acknowledge(Guid eventId)
113+
{
114+
_subscription.NotifyEventsProcessed(new[] { eventId });
115+
}
116+
117+
/// <summary>
118+
/// Acknowledge a group of messages by event id (this will tell the server it has been processed)
119+
/// </summary>
120+
/// <remarks>There is no need to ack a message if you have Auto Ack enabled</remarks>
121+
/// <param name="events">The <see cref="ResolvedEvent"></see> OriginalEvent.EventIds to acknowledge there should be less than 2000 to ack at a time.</param>
122+
public void Acknowledge(IEnumerable<Guid> events)
123+
{
124+
var ids = events.ToArray();
125+
if (ids.Length > 2000) throw new ArgumentOutOfRangeException("events", "events is limited to 2000 to ack at a time");
126+
_subscription.NotifyEventsProcessed(ids);
127+
}
107128
/// <summary>
108129
/// Mark a message failed processing. The server will be take action based upon the action paramter
109130
/// </summary>

0 commit comments

Comments
 (0)