Guest User

Untitled

a guest
Mar 23rd, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. [FunctionName("EventHubTrigger")]
  2. public static async Task RunAsync([EventHubTrigger("events", Connection = "EventHub")] EventData[] eventDataSet, TraceWriter log)
  3. {
  4. log.Info($"Triggered batch of size {eventDataSet.Length}");
  5. foreach (var eventData in eventDataSet) {
  6. // For every 100th message, throw an exception
  7. if (int.Parse((string)eventData.Properties["counter"]) % 100 == 0)
  8. {
  9. throw new SystemException("Some exception");
  10. }
  11.  
  12. // Insert the current count into Redis
  13. await db.ListRightPushAsync("events:" + eventData.Properties["partitionKey"], (string)eventData.Properties["counter"]);
  14. }
  15. }
Add Comment
Please, Sign In to add comment