Created
October 11, 2017 21:00
-
-
Save paulbatum/5909ff45271c71f3fa9f50c1b14a17c8 to your computer and use it in GitHub Desktop.
Setting PartitionKey in Azure Functions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#r "Microsoft.ServiceBus" | |
using System; | |
using System.Text; | |
using Microsoft.ServiceBus.Messaging; | |
public static void Run(EventData myEventHubMessage, TraceWriter log) | |
{ | |
log.Info($"C# Event Hub trigger function processed a message with partition key: {myEventHubMessage.PartitionKey}"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2017-10-11T21:00:17 Welcome, you are now connected to log-streaming service. | |
2017-10-11T21:00:20.041 Function started (Id=1181022f-fb8b-443e-b832-d7352b1f0f5c) | |
2017-10-11T21:00:20.041 C# Event Hub trigger function processed a message with partition key: abc123 | |
2017-10-11T21:00:20.041 Function completed (Success, Id=1181022f-fb8b-443e-b832-d7352b1f0f5c, Duration=0ms) | |
2017-10-11T21:00:25.011 Function started (Id=4fbc39a0-ad66-449b-bbf5-b5760ec2685e) | |
2017-10-11T21:00:25.011 C# Event Hub trigger function processed a message with partition key: abc123 | |
2017-10-11T21:00:25.011 Function completed (Success, Id=4fbc39a0-ad66-449b-bbf5-b5760ec2685e, Duration=0ms) | |
2017-10-11T21:00:30.030 Function started (Id=7479be7e-ccb5-4060-a936-79bb7c7f8e31) | |
2017-10-11T21:00:30.030 C# Event Hub trigger function processed a message with partition key: abc123 | |
2017-10-11T21:00:30.030 Function completed (Success, Id=7479be7e-ccb5-4060-a936-79bb7c7f8e31, Duration=0ms) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#r "Microsoft.ServiceBus" | |
using System; | |
using System.Text; | |
using Microsoft.ServiceBus.Messaging; | |
public static void Run(TimerInfo myTimer, TraceWriter log, ICollector<EventData> output) | |
{ | |
log.Info($"C# Timer trigger function executed at: {DateTime.Now}"); | |
var data = new EventData(Encoding.UTF8.GetBytes("Testing")); | |
data.PartitionKey = "abc123"; | |
output.Add(data); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment