Skip to content

Commit

Permalink
Add selective delete to Transfer deadletter subqueues and fix the con…
Browse files Browse the repository at this point in the history
…text menus for the Transfer Deadletter grid view (#768)

* Added support for deleting transfer DLQ messages
  • Loading branch information
ErikMogensen authored Feb 13, 2024
1 parent 81834c1 commit 27ba8a6
Show file tree
Hide file tree
Showing 8 changed files with 428 additions and 654 deletions.
20 changes: 16 additions & 4 deletions src/Common/Helpers/DeadLetterMessageHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ public DeadLetterMessageHandler(WriteToLogDelegate writeToLog, ServiceBusHelper
#endregion

#region Public methods
public async Task<DeletedDlqMessagesResult> DeleteMessages(List<long?> sequenceNumbers)
public async Task<DeletedDlqMessagesResult> DeleteMessages(List<long?> sequenceNumbers,
bool TransferDLQ)
{
var sequenceNumbersToDeleteList = new List<long?>();
foreach (var number in sequenceNumbers)
Expand All @@ -96,7 +97,7 @@ public async Task<DeletedDlqMessagesResult> DeleteMessages(List<long?> sequenceN
}

var timedOut = false;
var dlqEntityPath = GetDlqEntityPath();
var dlqEntityPath = TransferDLQ ? GetTransferDlqEntityPath() : GetDlqEntityPath();

var messageReceiver = await serviceBusHelper.MessagingFactory.CreateMessageReceiverAsync(
dlqEntityPath,
Expand Down Expand Up @@ -185,7 +186,7 @@ public async Task<DeletedDlqMessagesResult> DeleteMessages(List<long?> sequenceN


public async Task<DeletedDlqMessagesResult> MoveMessages(MessageSender messageSender,
List<long> sequenceNumbers, List<BrokeredMessage> messagesToSend = null)
List<long> sequenceNumbers, bool transferDLQ, List<BrokeredMessage> messagesToSend = null)
{
if (messagesToSend != null)
{
Expand All @@ -196,7 +197,7 @@ public async Task<DeletedDlqMessagesResult> MoveMessages(MessageSender messageSe
}
}

var dlqEntityPath = GetDlqEntityPath();
var dlqEntityPath = transferDLQ ? GetTransferDlqEntityPath() : GetDlqEntityPath();

var messageReceiver = serviceBusHelper.MessagingFactory.CreateMessageReceiver(
dlqEntityPath,
Expand Down Expand Up @@ -368,6 +369,17 @@ string GetDlqEntityPath()
sourceSubscriptionWrapper.SubscriptionDescription.TopicPath,
sourceSubscriptionWrapper.SubscriptionDescription.Name);
}

string GetTransferDlqEntityPath()
{
if (sourceQueueDescription != null)
{
return QueueClient.FormatTransferDeadLetterPath(sourceQueueDescription.Path);
}

throw new Exception("It is currently not supported getting a Transfer Dead-letter queue for a subscription.");
}

void WriteToLog(string message)
{
if (writeToLog != null && !string.IsNullOrWhiteSpace(message))
Expand Down
248 changes: 86 additions & 162 deletions src/ServiceBusExplorer/Controls/HandleQueueControl.Designer.cs

Large diffs are not rendered by default.

Loading

0 comments on commit 27ba8a6

Please sign in to comment.