AI agents: use the documentation index at llms.txt to locate machine-readable pages. This section is indexed by https://docs.particular.net/samples/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.

Unobtrusive

Component:
NServiceBus
NuGet Package:
NServiceBus 10.x

Code walk-through

There sample consists of the following projects:

  • Client: sends a request and a command to the server and handles a published event
  • Server: handles requests and commands, and publishes events
  • Shared: the shared message definitions

Configuring conventions for unobtrusive mode

The ConventionExtensions class tells NServiceBus how to determine which types are message definitions by passing in custom conventions instead of using the IMessage, ICommand, or IEvent interfaces:

public static void ApplyCustomConventions(this EndpointConfiguration endpointConfiguration)
{
    var conventions = endpointConfiguration.Conventions();

    conventions.DefiningCommandsAs(
        type =>
        type.Namespace != null &&
        type.Namespace.EndsWith("Commands"));

    conventions.DefiningEventsAs(
        type =>
        type.Namespace != null &&
        type.Namespace.EndsWith("Events"));

    conventions.DefiningMessagesAs(
        type => type.Namespace == "Messages");

    conventions.DefiningClaimCheckPropertiesAs(
        property => property.Name.EndsWith("ClaimCheck"));

    conventions.DefiningTimeToBeReceivedAs(
        type =>
        {
            if (type.Name.EndsWith("Expires"))
            {
                return TimeSpan.FromSeconds(30);
            }
            return TimeSpan.MaxValue;
        });
}

It also demonstrates how to configure conventions for the data bus and time-to-be-received features.

Related Articles