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.

Custom Azure Functions triggers

If the trigger function must be customized, you must disable generation of the trigger function by removing the NServiceBusTriggerFunction attribute. A custom trigger function can then be added manually to the project:

class CustomTriggerDefinition
{
    IFunctionEndpoint functionEndpoint;

    public CustomTriggerDefinition(IFunctionEndpoint functionEndpoint)
    {
        this.functionEndpoint = functionEndpoint;
    }

    [Function("MyCustomTrigger")]
    public async Task Run(
        [ServiceBusTrigger("MyFunctionsEndpoint")]
        ServiceBusReceivedMessage message, ServiceBusMessageActions messageActions, FunctionContext context,
        CancellationToken cancellationToken = default)
    {
        await functionEndpoint.Process(message, messageActions, context, cancellationToken);
    }
}

public class Program
{
    public async Task Main()
    {
        var host = new HostBuilder()
            .ConfigureFunctionsWorkerDefaults()
            .UseNServiceBus("MyFunctionsEndpoint")
            .Build();

        await host.RunAsync();
    }
}

The endpoint name in UseNServiceBus must match the queue name in the function, as illustrated above.

Related Articles