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.

Message Body Encryption

Component:
NServiceBus
NuGet Package:
NServiceBus 9.x

Message encryption leverages the pipeline to encrypt the entire serialized message body.

One way of achieving this is by using a transport message mutator.

public class MessageEncryptor :
    IMutateIncomingTransportMessages,
    IMutateOutgoingTransportMessages
{
    public Task MutateIncoming(MutateIncomingTransportMessageContext context)
    {
        context.Body = context.Body.ToArray().Reverse().ToArray();
        return Task.CompletedTask;
    }

    public Task MutateOutgoing(MutateOutgoingTransportMessageContext context)
    {
        context.OutgoingBody = context.OutgoingBody.ToArray().Reverse().ToArray();
        return Task.CompletedTask;
    }
}

The encrypting mutator must be injected via dependency injection:

endpointConfiguration.RegisterMessageMutator(new MessageEncryptor());

List of Samples

Related Articles

  • Security
    Security features for messages, transports, and persisters.