-
Notifications
You must be signed in to change notification settings - Fork 1
/
eventhubs-realtime-trigger.yaml
71 lines (61 loc) · 2.59 KB
/
eventhubs-realtime-trigger.yaml
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
id: eventhubs-realtime-trigger
namespace: company.team
tasks:
- id: insert_into_storagetable
type: io.kestra.plugin.azure.storage.table.Bulk
endpoint: https://yourstorageaccount.blob.core.windows.net
connectionString: "{{ secret('STORAGETABLE_CONNECTION') }}"
table: orders
from:
- partitionKey: order_id
rowKey: "{{ trigger.body | jq('.order_id') | first }}"
properties:
customer_name: "{{ trigger.body | jq('.customer_name') | first }}"
customer_email: "{{ trigger.body | jq('.customer_email') | first }}"
product_id: "{{ trigger.body | jq('.product_id') | first }}"
price: "{{ trigger.body | jq('.price') | first }}"
quantity: "{{ trigger.body | jq('.quantity') | first }}"
total: "{{ trigger.body | jq('.total') | first }}"
triggers:
- id: realtime_trigger
type: io.kestra.plugin.azure.eventhubs.RealtimeTrigger
eventHubName: orders
namespace: kestra
connectionString: "{{ secret('EVENTHUBS_CONNECTION') }}"
bodyDeserializer: JSON
consumerGroup: $Default
checkpointStoreProperties:
containerName: kestra
connectionString: "{{ secret('BLOB_CONNECTION') }}"
extend:
title: Use Azure Eventhubs Realtime Trigger to push events into StorageTable
description: >-
This flow will:
1. Get
[triggered](https://kestra.io/plugins/plugin-azure/triggers/io.kestra.plugin.azure.eventhubs.realtimetrigger)
every time the event lands in the Azure Eventhub
2. The flow will push the data into StorageTable table
For this, create an Azure Eventhub named `orders` under `kestra` namespace.
We will be producing JSON messages into the Eventhub generated from the
[orders.csv](https://huggingface.co/datasets/kestra/datasets/raw/main/csv/orders.csv).
One sample produced message can be:
```
{"order_id": "1", "customer_name": "Kelly Olsen", "customer_email":
"[email protected]", "product_id": "20", "price": "166.89",
"quantity": "1", "total": "166.89"}
```
Create `orders` table in the StorageTable.
We get the connectionString for Eventhubs, Blob and StorageTable from the
secrets `EVENTHUBS_CONNECTION`, `BLOB_CONNECTION` and
`STORAGETABLE_CONNECTION` respectively.
When you produce the message onto Eventhub, the flow will get triggered, and
you can see that a corresponding new record gets into the StorageTable
table.
tags:
- Realtime Trigger
- Azure
- Queue
- Trigger
ee: false
demo: false
meta_description: Use Azure Eventhubs Realtime Trigger to push events into StorageTable