https://github.com/tmasternak/nservicebus.functions
NServiceBus trigger for Azure Functions sample
https://github.com/tmasternak/nservicebus.functions
azure-functions azure-storage-queue nservicebus
Last synced: 2 months ago
JSON representation
NServiceBus trigger for Azure Functions sample
- Host: GitHub
- URL: https://github.com/tmasternak/nservicebus.functions
- Owner: tmasternak
- Created: 2018-04-24T12:29:15.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-10-04T07:45:11.000Z (over 5 years ago)
- Last Synced: 2025-03-28T01:46:06.413Z (3 months ago)
- Topics: azure-functions, azure-storage-queue, nservicebus
- Language: C#
- Size: 15.6 KB
- Stars: 8
- Watchers: 0
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# NServiceBus.Functions
This is a sample project that demonstrates integration between self-hosted NServiceBus endpoint and an Azure function. In this setup the function plays a role of a handler for `PingCommand`s send from the `Sender` endpoint.The [function](https://github.com/tmasternak/NServiceBus.Functions/blob/master/NServiceBus.Function/TheFunction.cs) has the following form:
```csharp
[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 argument `NServiceBusCollector` handles messages generated by the function on execution.