Custom Azure Functions triggers

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

class CustomTriggerDefinition
{
    readonly IFunctionEndpoint endpoint;

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

    [FunctionName("MyCustomTrigger")]
    public async Task Run(
        [ServiceBusTrigger(queueName: "MyFunctionsEndpoint")]
        Message message,
        ILogger logger,
        ExecutionContext executionContext)
    {
        await endpoint.Process(message, executionContext, logger);
    }
}

Related Articles


Last modified