AI agents: use the documentation index at llms.txt to locate machine-readable pages. This section is indexed by https://docs.particular.net/nservicebus/llms.txt. The markdown version of this page is served as plain text. An MCP server at /mcp serves the same content via the search_docs and read_doc tools; it is read-only and needs no credentials. Markdown versions of documentation pages are available by appending .md to the page URL. Directory URLs use index.md. They are served as text/plain because some retrieval backends reject text/markdown.

Pipeline events

Component:
NServiceBus
NuGet Package:
NServiceBus 9.x

The pipeline raises the following notification events:

Receive pipeline completed

Every time a receive pipeline is completed, a ReceivePipelineCompleted event will be raised. This event will not occur when message processing fails, e.g., inside a handler.

Use the following configuration code to subscribe to the event:

endpointConfiguration.Pipeline.OnReceivePipelineCompleted(
    subscription: (completed, ct) =>
    {
        var duration = completed.CompletedAt - completed.StartedAt;
        log.Info($"Receive completed. Message: {completed.ProcessedMessage.MessageId}, duration: {duration}");
        return Task.CompletedTask;
    });

Subscribing from a feature is shown below:

var pipeline = context.Pipeline;
pipeline.OnReceivePipelineCompleted(
    subscription: (completed, ct) =>
    {
        var duration = completed.CompletedAt - completed.StartedAt;
        log.Info($"Receive completed: Message: {completed.ProcessedMessage.MessageId}, duration: {duration}");
        return Task.CompletedTask;
    });

Related Articles

  • Recoverability
    Explains how exceptions are handled, and actions retried, during message processing.