diff --git a/samples/servicecontrol/events-subscription/ServiceControlContracts_5/EndpointsMonitor/CustomEventsHandler.cs b/samples/servicecontrol/events-subscription/ServiceControlContracts_5/EndpointsMonitor/CustomEventsHandler.cs index e80f228d5ab..0a8bba4143a 100644 --- a/samples/servicecontrol/events-subscription/ServiceControlContracts_5/EndpointsMonitor/CustomEventsHandler.cs +++ b/samples/servicecontrol/events-subscription/ServiceControlContracts_5/EndpointsMonitor/CustomEventsHandler.cs @@ -10,7 +10,8 @@ public class CustomEventsHandler(ILogger logger) : IHandleMessages, IHandleMessages, IHandleMessages, - IHandleMessages + IHandleMessages, + IHandleMessages { public Task Handle(MessageFailed message, IMessageHandlerContext context) @@ -54,6 +55,12 @@ public Task Handle(MessageFailureResolvedManually message, IMessageHandlerContex logger.LogError("Received ServiceControl 'MessageFailureResolvedManually' with ID {FailedMessageId}.", message.FailedMessageId); return Task.CompletedTask; } + + public Task Handle(MessageEditedAndRetried message, IMessageHandlerContext context) + { + logger.LogError("Received ServiceControl 'MessageEditedAndRetried' with ID {FailedMessageId}.", message.FailedMessageId); + return Task.CompletedTask; + } } #endregion \ No newline at end of file diff --git a/samples/servicecontrol/events-subscription/sample.md b/samples/servicecontrol/events-subscription/sample.md index f8be30321cf..08c3440f6f7 100644 --- a/samples/servicecontrol/events-subscription/sample.md +++ b/samples/servicecontrol/events-subscription/sample.md @@ -59,6 +59,11 @@ Next, restart the `NServiceBusEndpoint` application and wait up to 30 seconds. W > `Heartbeat from EndpointsMonitoring.NServiceBusEndpoint restored.` +### MessageEditedAndRetried event + +The `MessageEditedAndRetried` event is emitted when the [Edit and Retry feature](/servicepulse/intro-editing-messages.md) is used on a message that failed. This can be done only from ServicePulse. + +The event is emitted each time a new edited message is successfully created and dispatched. ## Code walk-through diff --git a/servicecontrol/contracts.md b/servicecontrol/contracts.md index b4c2cd8125f..fbb776a4e9b 100644 --- a/servicecontrol/contracts.md +++ b/servicecontrol/contracts.md @@ -87,7 +87,7 @@ ServiceControl will also publish events related to archiving and retrying messag - `FailedMessagesUnArchived`: Event emitted for failed messages that were un-archived (restored from the archive), making them eligible for retry or further action - `MessageFailureResolvedByRetry`: Event emitted by ServiceControl for each failed message that succeeded after retrying - `MessageFailureResolvedManually`: Event emitted by ServiceControl for each failed message that was manually marked as resolved, typically via the "Resolve" or "Resolve All" actions in ServicePulse - +- `MessageEditedAndRetried`: Event emitted by ServiceControl every time that a failed message was [edited and retried](/servicepulse/intro-editing-messages.md) ## Decommissioning subscribers to ServiceControl events diff --git a/servicepulse/intro-editing-messages.md b/servicepulse/intro-editing-messages.md index ea2588c016f..f31384d93ec 100644 --- a/servicepulse/intro-editing-messages.md +++ b/servicepulse/intro-editing-messages.md @@ -62,6 +62,8 @@ When retrying an edited message it is possible that the original failed message As soon as a message has been dispatched for retrying the originally failing message will be marked as resolved. If the retry message subsequently fails it will appear as a new failed message in the user interface. That new failed message will be marked as having been edited and also have a link to the original message. +Retrying a message, regardless whether it is processed correctly or not, dispatches also a [`MessageEditedAndRetried` event](/servicecontrol/contracts.md#other-events). That event includes an ID of the original message. + The copy of the failed message receives a new [message ID](/nservicebus/messaging/message-identity.md). The copied message is related to the original failed message through the [`NServiceBus.CorrelationId`](/nservicebus/messaging/headers.md#messaging-interaction-headers-nservicebus-correlationid) header that is set to the ID of the original message. The copy carries also the same [`NServiceBus.ConversationId`](/nservicebus/messaging/headers.md#messaging-interaction-headers-nservicebus-conversationid) as the original. ## Limitations and restrictions