Skip to content

Commit

Permalink
Add VisibilityTimeout to the SQS Queue creation options
Browse files Browse the repository at this point in the history
  • Loading branch information
jamescarter-le committed Feb 29, 2024
1 parent 0818948 commit f4bb41f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/AWS/Orleans.Streaming.SQS/Storage/SQSStorage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,12 @@ public async Task InitQueueAsync()
sqsOptions.ReceiveWaitTimeSeconds.Value.ToString());
}

if (sqsOptions.VisibilityTimeoutSeconds.HasValue)
{
createQueueRequest.Attributes.Add(QueueAttributeName.VisibilityTimeout,
sqsOptions.VisibilityTimeoutSeconds.Value.ToString());
}

var response = await sqsClient.CreateQueueAsync(createQueueRequest);
queueUrl = response.QueueUrl;
}
Expand Down
9 changes: 9 additions & 0 deletions src/AWS/Orleans.Streaming.SQS/Streams/SqsStreamOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,15 @@ public class SqsOptions
/// </summary>
public int? ReceiveWaitTimeSeconds { get; set; }

/// <summary>
/// The visibility timeout begins when Amazon SQS returns a message.
/// During this time, the consumer processes and deletes the message.
/// However, if the consumer fails before deleting the message and your system doesn't call the DeleteMessage action for that message before the visibility timeout expires,
/// the message becomes visible to other consumers and the message is received again.
/// If a message must be received only once, your consumer should delete it within the duration of the visibility timeout.
/// </summary>
public int? VisibilityTimeoutSeconds { get; set; }

public bool FifoQueue { get; set; }
}
}

0 comments on commit f4bb41f

Please sign in to comment.