-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathhttp-zilla.yaml
170 lines (166 loc) · 3.88 KB
/
http-zilla.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
name: http-quickstart
bindings:
# Proxy service entrypoint
north_tcp_server:
type: tcp
kind: server
options:
host: 0.0.0.0
port:
- 7114
routes:
- when:
- port: 7114
exit: north_http_server
telemetry:
metrics:
- stream.*
north_http_server:
type: http
kind: server
options:
versions:
- h2
- http/1.1
access-control:
policy: cross-origin
routes:
- when:
- headers:
:path: /api/stream
exit: north_sse_server
- when:
- headers:
:path: /api/stream/*
exit: north_sse_server
- when:
- headers:
:path: /api/*
exit: north_rest_api_http_kafka_mapping
telemetry:
metrics:
- stream.*
- http.*
# REST proxy endpoints to Kafka a topic
north_rest_api_http_kafka_mapping:
type: http-kafka
kind: proxy
routes:
#region rest_create
- when:
- method: POST
path: /api/items
exit: north_kafka_cache_client
with:
capability: produce
topic: http-messages
key: ${idempotencyKey}
#endregion rest_create
#region rest_update
- when:
- method: PUT
path: /api/items/{id}
exit: north_kafka_cache_client
with:
capability: produce
topic: http-messages
key: ${params.id}
#endregion rest_update
#region rest_delete
- when:
- method: DELETE
path: /api/items/{id}
exit: north_kafka_cache_client
with:
capability: produce
topic: http-messages
key: ${params.id}
#endregion rest_delete
#region rest_retrieve_all
- when:
- method: GET
path: /api/items
exit: north_kafka_cache_client
with:
capability: fetch
topic: http-messages
merge:
content-type: application/json
#endregion rest_retrieve_all
#region rest_retrieve_id
- when:
- method: GET
path: /api/items/{id}
exit: north_kafka_cache_client
with:
capability: fetch
topic: http-messages
filters:
- key: ${params.id}
#endregion rest_retrieve_id
# SSE Server to Kafka topics
north_sse_server:
type: sse
kind: server
exit: north_sse_kafka_mapping
north_sse_kafka_mapping:
type: sse-kafka
kind: proxy
routes:
#region sse_stream_all
- when:
- path: /api/stream
exit: north_kafka_cache_client
with:
topic: http-messages
#endregion sse_stream_all
#region sse_stream_id
- when:
- path: /api/stream/{id}
exit: north_kafka_cache_client
with:
topic: http-messages
filters:
- key: ${params.id}
#endregion sse_stream_id
# Kafka sync layer
north_kafka_cache_client:
type: kafka
kind: cache_client
exit: south_kafka_cache_server
south_kafka_cache_server:
type: kafka
kind: cache_server
options:
bootstrap:
- http-messages
exit: south_kafka_client
# Connect to local Kafka
south_kafka_client:
type: kafka
kind: client
options:
servers:
- ${{env.KAFKA_BOOTSTRAP_SERVER}}
exit: south_tcp_client
south_tcp_client:
type: tcp
kind: client
telemetry:
# Desired metrics to track
metrics:
- http.active.requests
- http.request.size
- http.response.size
- stream.opens.sent
- stream.opens.received
- stream.closes.sent
- stream.closes.received
- stream.errors.sent
- stream.errors.received
- stream.active.sent
- stream.active.received
exporters:
# Enable Standard Out logs
stdout_logs_exporter:
type: stdout