Skip to content

Commit

Permalink
Allow developers to configure 'FetchCount'
Browse files Browse the repository at this point in the history
Resolves #40
  • Loading branch information
Jericho committed Jan 30, 2024
1 parent fab02e9 commit 1db1340
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Source/Picton.Messaging/AsyncMessagePump.cs
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ private async Task ProcessMessagesAsync(CancellationToken cancellationToken)

try
{
messages = await queueInfo.QueueManager.GetMessagesAsync(_messagePumpOptions.ConcurrentTasks, queueInfo.Config.VisibilityTimeout, cancellationToken).ConfigureAwait(false);
messages = await queueInfo.QueueManager.GetMessagesAsync(_messagePumpOptions.FetchCount, queueInfo.Config.VisibilityTimeout, cancellationToken).ConfigureAwait(false);
}
catch (Exception e) when (e is TaskCanceledException || e is OperationCanceledException)
{
Expand Down
6 changes: 6 additions & 0 deletions Source/Picton.Messaging/MessagePumpOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ namespace Picton.Messaging
public record MessagePumpOptions
{
private const int _defaultConcurrentTasks = 25;
private const int _defaultFetchCount = 10;
private static readonly TimeSpan _defaultFetchMessagesInterval = TimeSpan.FromSeconds(1);
private static readonly TimeSpan _defaultCountAzureMessagesInterval = TimeSpan.FromSeconds(5);
private static readonly TimeSpan _defaultCountMemoryMessagesInterval = TimeSpan.FromSeconds(5);
Expand Down Expand Up @@ -54,6 +55,11 @@ public MessagePumpOptions(string connectionString, int? concurrentTasks, QueueCl
/// </summary>
public int ConcurrentTasks { get; set; } = _defaultConcurrentTasks;

/// <summary>
/// Gets or sets the number of messages fetched per queue.
/// </summary>
public int FetchCount { get; set; } = _defaultFetchCount;

/// <summary>
/// Gets or sets the optional client options that define the transport
/// pipeline policies for authentication, retries, etc., that are applied
Expand Down

0 comments on commit 1db1340

Please sign in to comment.