Skip to content

udidahan/NServiceBus.Functions

 
 

Repository files navigation

NServiceBus.Functions

This is a sample project that demonstrates integration between self-hoted NServiceBus endpoint and an Azure function. In this setup the function plays a role of a handler for PingCommands send from the Sender endpoint.

The function has the following form:

[FunctionName("TheFunction")]
public static void Run([NServiceBusTrigger(QueueName = "main-queue")]PingCommand command, NServiceBusCollector collector, TraceWriter log)
{
    log.Info($"NSB function triggered: {command.Text}");

    collector.AddReply(new PongReply{Text = $"Hello {command.Text}. Timestamp: {DateTime.UtcNow.Ticks}"});
}

It's tiggered via NServiceBusTrigger running on top of ASQ transport that passes the input POCO command. The second arguemnt NServiceBusCollector handles messages generated by the function on execution.

About

NServiceBus trigger for Azure Functions sample

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%