-
Notifications
You must be signed in to change notification settings - Fork 35
/
PrintTopicMessage.cs
27 lines (25 loc) · 996 Bytes
/
PrintTopicMessage.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// ------------------------------------------------------------
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
// ------------------------------------------------------------
namespace dotnet_azurefunction
{
using CloudNative.CloudEvents;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions.Dapr;
using Microsoft.Extensions.Logging;
public static class PrintTopicMessage
{
/// <summary>
/// Sample to use Dapr Publish trigger to print any new message arrived on the subscribed topic.
/// </summary>
[FunctionName("PrintTopicMessage")]
public static void Run(
[DaprTopicTrigger("%PubSubName%", Topic = "B")] CloudEvent subEvent,
ILogger log)
{
log.LogInformation("C# function processed a PrintTopicMessage request from the Dapr Runtime.");
log.LogInformation($"Topic B received a message: {subEvent.Data}.");
}
}
}