Skip to content

Instantly share code, notes, and snippets.

@sjwaight
Created December 19, 2016 21:55
Show Gist options
  • Save sjwaight/10ac11fe91a9e0ff5b23ba6a3c3c6962 to your computer and use it in GitHub Desktop.
Save sjwaight/10ac11fe91a9e0ff5b23ba6a3c3c6962 to your computer and use it in GitHub Desktop.
Demo of how to read an Event Hub / Stream Analytics / Service Bus message in an Azure Function
using Microsoft.ServiceBus.Messaging;
using Microsoft.ServiceBus;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
public static void Run(BrokeredMessage sbQueueItem, TraceWriter log)
{
var yourRecord = sbQueueItem.GetBody<string>();
var paymenRequest = JObject.Parse(yourRecord);
var vendorId = paymenRequest.SelectToken("vendorId").ToString();
// use your data as you wish from here.
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment