Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Configurable Exponential Backoff in Pull Delivery #150

Merged
merged 5 commits into from
Jul 18, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="AutoBogus" Version="2.13.1" />
<PackageReference Include="CliWrap" Version="3.6.6" />
<PackageReference Include="FakeItEasy" Version="8.0.0" />
<PackageReference Include="GSoft.Extensions.Xunit" Version="1.0.1" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,24 @@ public async Task<IEnumerable<EventBundle>> ReceiveCloudEventsAsync(string topic
var result = await this._adaptee.ReceiveCloudEventsAsync(topicName, eventSubscriptionName, maxEvents, cancellationToken: cancellationToken).ConfigureAwait(false);

return result.HasValue
? result.Value.Value.Select(x => new EventBundle(x.Event, x.BrokerProperties.LockToken))
: Array.Empty<EventBundle>();
? result.Value.Value.Select(x => new EventBundle(x.Event, x.BrokerProperties.LockToken, x.BrokerProperties.DeliveryCount))
: [];
}

public Task AcknowledgeCloudEventsAsync(string topicName, string eventSubscriptionName, IEnumerable<string> lockTokens, CancellationToken cancellationToken)
{
return this._adaptee.AcknowledgeCloudEventsAsync(topicName, eventSubscriptionName, new AcknowledgeOptions(lockTokens), cancellationToken);
}

public Task ReleaseCloudEventsAsync(string topicName, string eventSubscriptionName, IEnumerable<string> lockTokens, CancellationToken cancellationToken)
public Task ReleaseCloudEventsAsync(string topicName, string eventSubscriptionName, IEnumerable<string> lockTokens, TimeSpan releaseDelay, CancellationToken cancellationToken)
{
return this._adaptee.ReleaseCloudEventsAsync(topicName, eventSubscriptionName, new ReleaseOptions(lockTokens), cancellationToken: cancellationToken);
return this._adaptee.ReleaseCloudEventsAsync(topicName, eventSubscriptionName, new ReleaseOptions(lockTokens), releaseDelay.Seconds, cancellationToken);
}

public Task RejectCloudEventsAsync(string topicName, string eventSubscriptionName, IEnumerable<string> lockTokens, CancellationToken cancellationToken)
{
return this._adaptee.RejectCloudEventsAsync(topicName, eventSubscriptionName, new RejectOptions(lockTokens), cancellationToken);
}

internal sealed record EventBundle(CloudEvent Event, string LockToken);
internal sealed record EventBundle(CloudEvent Event, string LockToken, int DeliveryCount);
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ internal interface IEventGridClientAdapter

Task AcknowledgeCloudEventsAsync(string topicName, string eventSubscriptionName, IEnumerable<string> lockTokens, CancellationToken cancellationToken);

Task ReleaseCloudEventsAsync(string topicName, string eventSubscriptionName, IEnumerable<string> lockTokens, CancellationToken cancellationToken);
Task ReleaseCloudEventsAsync(string topicName, string eventSubscriptionName, IEnumerable<string> lockTokens, TimeSpan releaseDelay, CancellationToken cancellationToken);

Task RejectCloudEventsAsync(string topicName, string eventSubscriptionName, IEnumerable<string> lockTokens, CancellationToken cancellationToken);
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@ public class EventPropagationSubscriptionOptions
public string SubscriptionName { get; set; } = string.Empty;

public int MaxDegreeOfParallelism { get; set; } = 1;

public IReadOnlyCollection<TimeSpan>? RetryDelays { get; set; }
}

Large diffs are not rendered by default.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ Workleap.DomainEventPropagation.EventPropagationSubscriptionOptions.TopicName.ge
Workleap.DomainEventPropagation.EventPropagationSubscriptionOptions.TopicName.set -> void
Workleap.DomainEventPropagation.EventPropagationSubscriptionOptions.MaxDegreeOfParallelism.get -> int
Workleap.DomainEventPropagation.EventPropagationSubscriptionOptions.MaxDegreeOfParallelism.set -> void
Workleap.DomainEventPropagation.EventPropagationSubscriptionOptions.RetryDelays.get -> System.Collections.Generic.IReadOnlyCollection<System.TimeSpan>?
Workleap.DomainEventPropagation.EventPropagationSubscriptionOptions.RetryDelays.set -> void
Workleap.DomainEventPropagation.EventPropagationSubscriptionOptionsValidator
Workleap.DomainEventPropagation.EventPropagationSubscriptionOptionsValidator.EventPropagationSubscriptionOptionsValidator() -> void
Workleap.DomainEventPropagation.EventPropagationSubscriptionOptionsValidator.Validate(string! name, Workleap.DomainEventPropagation.EventPropagationSubscriptionOptions! options) -> Microsoft.Extensions.Options.ValidateOptionsResult!
Expand Down