# Recoverability pipeline The recoverability [pipeline](/nservicebus/pipeline/index.md) allows for advanced customization of the metadata captured during message failures as well as full control over the recoverability action taken. The example below shows how to extend the pipeline with a behavior that: - Stores the message body in an external storage - Excludes the body from the message sent to the error queue - Adds a metadata entry that links to the stored body ```cs public class EnableExternalBodyStorageBehavior : Behavior { private readonly IExternalBodyStorage storage; public EnableExternalBodyStorageBehavior(IExternalBodyStorage storage) { this.storage = storage; } public async override Task Invoke(IRecoverabilityContext context, Func next) { if (context.RecoverabilityAction is MoveToError errorAction) { var bodyUrl = await storage.StoreBody(context.MessageId, context.Body); context.Metadata["body-url"] = bodyUrl; context.RecoverabilityAction = new SkipFailedMessageBody(errorAction.ErrorQueue); } await next(); } class SkipFailedMessageBody : MoveToError { public SkipFailedMessageBody(string errorQueue) : base(errorQueue) { } public override IReadOnlyCollection GetRoutingContexts(IRecoverabilityActionContext context) { var routingContexts = base.GetRoutingContexts(context); foreach (var routingContext in routingContexts) { // clear out the message body routingContext.Message.UpdateBody(ReadOnlyMemory.Empty); } return routingContexts; } } } ``` In addition, the behavior must be [registered in the pipeline](/nservicebus/pipeline/manipulate-with-behaviors.md#add-a-new-step).