Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ public class CustomEventsHandler(ILogger<CustomEventsHandler> logger) :
IHandleMessages<FailedMessagesArchived>,
IHandleMessages<FailedMessagesUnArchived>,
IHandleMessages<MessageFailureResolvedByRetry>,
IHandleMessages<MessageFailureResolvedManually>
IHandleMessages<MessageFailureResolvedManually>,
IHandleMessages<MessageEditedAndRetried>
{

public Task Handle(MessageFailed message, IMessageHandlerContext context)
Expand Down Expand Up @@ -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
5 changes: 5 additions & 0 deletions samples/servicecontrol/events-subscription/sample.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion servicecontrol/contracts.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 2 additions & 0 deletions servicepulse/intro-editing-messages.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down