Skip to content

Repository files navigation

Azure Event Hub API App

Deploy to Azure

Deploying

Click the "Deploy to Azure" button above. You can create new resources or reference existing ones (resource group, gateway, service plan, etc.) Site Name and Gateway must be unique URL hostnames. The deployment script will deploy the following:

  • Resource Group (optional)
  • Service Plan (if you don't reference exisiting one)
  • Gateway (if you don't reference existing one)
  • API App (EventHubAPI)
  • API App Host (this is the site behind the api app that this github code deploys to)

API Documentation

The app has one webhook trigger (Receive Message) and one action (Send Message)

Receive Message webhook Trigger

The trigger has the following inputs

InputDescription
Connection StringThe connection string to access the event hub.
Event Hub NameName of the event hub (e.g. myeventhub )
Consumer GroupName of the consumer group the API App will subscribe to for messages (uses default consumer group if left blank)
Partition List (optional)A comma separated list of the partitions to subscribe to (e.g. 1,2,3,4,6,7,8). Leaving blank will subscribe to all available partitions for the Event Hub.

The trigger will return the message as @{triggerBody()}. It is returned as a JToken, so you can parse through the JSON like @{triggerBody()[0].eventtoken}.

Sample webhook subscription:

"triggers": {
"EhubTrigger": {
"conditions": [],
"inputs": {
"subscribe": {
"body": {
"callbackUrl": "@{listCallbackUrl()}",
"eventHubConnectionString": "Endpoint=sb://[namespace].servicebus.windows.net/;SharedAccessKeyName=[keyname];SharedAccessKey=[key]",
"eventHubName": "[hubname]"
},
"headers": {
"content-type": "application/json"
},
"method": "POST",
"uri": "https://eventhubapiapp.azurewebsites.net:443/Subscribe"
},
"unsubscribe": {
"body": {
"callbackUrl": "@{listCallbackUrl()}"
},
"headers": {
"content-type": "application/json"
},
"method": "POST",
"uri": "https://eventhubapiapp.azurewebsites.net:443/Unsubscribe"
}
},
"type": "HttpWebhook"
}
}

Send Message Action

The action has the following inputs. It returns an EventData object

InputDescription
Connection StringThe connection string to access the event hub.
Event Hub NameName of the event hub (e.g. myeventhub )
MessageThe message to send
Message PropertiesThe custom properties for the event hub message. Should be a JSON Object (e.g. {"foo": "bar", "awesome": true }
Partition KeyPartition Key for the event hub message

About

Azure Event Hub Trigger and Actions for Logic App

Resources

Stars

9 stars

Watchers

3 watching

Forks

Releases

Packages

Contributors

Languages