Skip to content

Commit 72a8af8

Browse files
committed
add kafka connection settings description
Signed-off-by: David Hontecillas <dhontecillas@gmail.com>
1 parent f76e30d commit 72a8af8

File tree

12 files changed

+1024
-2
lines changed

12 files changed

+1024
-2
lines changed

test/v2.13/messaging/kafka.json

Lines changed: 238 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,238 @@
1+
{
2+
"description": "Full JSON Schema test",
3+
"target": "https://www.krakend.io/schema/v2.13/krakend.json",
4+
"tests": [
5+
{
6+
"description": "Workflow test case",
7+
"data": {
8+
"version": 3,
9+
"debug_endpoint": true,
10+
"host": [
11+
"http://localhost:8080"
12+
],
13+
"async_agent": [
14+
{
15+
"name": "stocksconsumer",
16+
"extra_config": {
17+
"async/kafka": {
18+
"group_id": "my_group_id",
19+
"topics": [
20+
"stockprice"
21+
],
22+
"connection": {
23+
"brokers": [
24+
"localhost:9092"
25+
],
26+
"client_id": "cid_stocksconsumer"
27+
},
28+
"consumer": {}
29+
}
30+
},
31+
"connection": {
32+
"max_retries": 2,
33+
"backoff_strategy": "linear",
34+
"health_interval": "30s"
35+
},
36+
"consumer": {
37+
"topic": "*",
38+
"workers": 1,
39+
"timeout": "1s"
40+
},
41+
"backend": [
42+
{
43+
"url_pattern": "/__debug/stocksconsumer/received"
44+
}
45+
]
46+
},
47+
{
48+
"name": "portfolioupdatesconsumer",
49+
"extra_config": {
50+
"async/kafka": {
51+
"group_id": "k_async_updates",
52+
"topics": [
53+
"portfolioupdates"
54+
],
55+
"connection": {
56+
"brokers": [
57+
"localhost:49092"
58+
],
59+
"client_id": "cid_portfolioupdateconsumer",
60+
"client_tls": {
61+
"allow_insecure_connections": false,
62+
"ca_certs": [
63+
"./config/ca/cacert.pem"
64+
],
65+
"client_certs": [
66+
{
67+
"certificate": "./config/certs/client/client.signed.pem",
68+
"private_key": "./config/certs/client/client.key"
69+
}
70+
]
71+
}
72+
},
73+
"consumer": {}
74+
}
75+
},
76+
"connection": {
77+
"max_retries": 2,
78+
"backoff_strategy": "linear",
79+
"health_interval": "30s"
80+
},
81+
"consumer": {
82+
"topic": "*",
83+
"workers": 1,
84+
"timeout": "1s"
85+
},
86+
"backend": [
87+
{
88+
"url_pattern": "/__debug/portfolioupdates/received"
89+
}
90+
]
91+
}
92+
],
93+
"endpoints": [
94+
{
95+
"endpoint": "/portfolio/order",
96+
"method": "POST",
97+
"input_headers": [
98+
"X-Idempotency-Key",
99+
"Some-Meta"
100+
],
101+
"backend": [
102+
{
103+
"url_pattern": "/_publisher/",
104+
"extra_config": {
105+
"backend/pubsub/publisher/kafka": {
106+
"success_status_code": 201,
107+
"writer": {
108+
"topic": "orderplacement",
109+
"key_meta": "X-Idempotency-Key",
110+
"connection": {
111+
"brokers": [
112+
"localhost:49092"
113+
],
114+
"client_id": "krakend_async_agent",
115+
"client_tls": {
116+
"allow_insecure_connections": false,
117+
"ca_certs": [
118+
"./config/ca/cacert.pem"
119+
],
120+
"client_certs": [
121+
{
122+
"certificate": "./config/certs/client/client.signed.pem",
123+
"private_key": "./config/certs/client/client.key"
124+
}
125+
]
126+
}
127+
},
128+
"producer": {
129+
"idempotent": true
130+
}
131+
}
132+
}
133+
}
134+
}
135+
]
136+
},
137+
{
138+
"endpoint": "/portfolio/order",
139+
"method": "GET",
140+
"backend": [
141+
{
142+
"url_pattern": "/_consumer/",
143+
"extra_config": {
144+
"backend/pubsub/subscriber/kafka": {
145+
"reader": {
146+
"topics": [
147+
"orderplacement"
148+
],
149+
"key_meta": "X-Idempotency-Key",
150+
"group_id": "k_endpoint_read",
151+
"connection": {
152+
"brokers": [
153+
"localhost:49092"
154+
],
155+
"client_id": "krakend_async_agent",
156+
"client_tls": {
157+
"allow_insecure_connections": false,
158+
"ca_certs": [
159+
"./config/ca/cacert.pem"
160+
],
161+
"client_certs": [
162+
{
163+
"certificate": "./config/certs/client/client.signed.pem",
164+
"private_key": "./config/certs/client/client.key"
165+
}
166+
]
167+
}
168+
},
169+
"consumer": {
170+
"isolation_level": "read_commited"
171+
}
172+
}
173+
}
174+
}
175+
}
176+
]
177+
}
178+
],
179+
"extra_config": {
180+
"telemetry/opentelemetry": {
181+
"service_name": "krakend_prometheus_service",
182+
"metric_reporting_period": 1,
183+
"trace_sample_rate": 1,
184+
"exporters": {
185+
"otlp": [
186+
{
187+
"disable_metrics": true,
188+
"disable_traces": false,
189+
"host": "localhost",
190+
"name": "tempo",
191+
"port": 54317,
192+
"use_http": false
193+
}
194+
],
195+
"prometheus": [
196+
{
197+
"name": "local_prometheus",
198+
"port": 9099,
199+
"process_metrics": true,
200+
"go_metrics": true
201+
}
202+
]
203+
},
204+
"layers": {
205+
"global": {
206+
"disable_metrics": false,
207+
"disable_propagation": false,
208+
"disable_traces": false,
209+
"report_headers": true
210+
},
211+
"proxy": {
212+
"disable_metrics": false,
213+
"disable_traces": true,
214+
"report_headers": true
215+
},
216+
"backend": {
217+
"metrics": {
218+
"detailed_connection": true,
219+
"disable_stage": false,
220+
"read_payload": false,
221+
"round_trip": false
222+
},
223+
"traces": {
224+
"detailed_connection": false,
225+
"disable_stage": false,
226+
"read_payload": false,
227+
"report_headers": false,
228+
"round_trip": false
229+
}
230+
}
231+
}
232+
}
233+
}
234+
},
235+
"valid": true
236+
}
237+
]
238+
}

v2.13/async_agent.json

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,24 @@
8484
},
8585
"extra_config": {
8686
"description": "Defines the driver that connects to your queue or PubSub system. In addition, you can place other middlewares to modify the request (message) or the response, apply logic or any other endpoint middleware, but adding the driver is mandatory.\n\nSee: https://www.krakend.io/docs/async/",
87-
"required": [ "async/amqp" ],
87+
"oneOf": [
88+
{
89+
"required": [ "async/amqp" ]
90+
},
91+
{
92+
"required": [ "async/kafka" ]
93+
}
94+
],
8895
"properties": {
8996
"async/amqp": {
9097
"title": "Async Agent extra configuration",
9198
"description": "[See the configuration for async/amqp](https://www.krakend.io/docs/async/amqp/)",
9299
"$ref": "async/amqp.json"
100+
},
101+
"async/kafka": {
102+
"title": "Kafka driver",
103+
"description": "config details to consume from kafka topics",
104+
"$ref": "messaging/kafka/reader.json"
93105
}
94106
}
95107
},
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2019-09/schema",
3+
"$id": "https://www.krakend.io/schema/v2.13/backend/pubsub/kafka/publisher.json",
4+
"title": "PubSub Kafka Publisher EE",
5+
"description": "Enterprise only. Allows for fine grained control over a kafka publishing connection",
6+
"type": "object",
7+
"required": [ "writer" ],
8+
"properties": {
9+
"success_status_code": {
10+
"title": "Success Status Code",
11+
"description": "http status code to return for a successful write in the queue",
12+
"type": "number",
13+
"maximum": 201,
14+
"minimum": 200
15+
},
16+
"writer": {
17+
"title": "Writer",
18+
"description": "Define how to write messages to a kafka topic",
19+
"$ref": "../../../messaging/kafka/writer.json"
20+
}
21+
},
22+
"patternProperties": {
23+
"^[@$_#]": true
24+
},
25+
"additionalProperties": false
26+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2019-09/schema",
3+
"$id": "https://www.krakend.io/schema/v2.13/backend/pubsub/kafka/subscriber.json",
4+
"title": "PubSub Kafka Subscriber EE",
5+
"description": "Enterprise only. Allows for fine grained control over a kafka subcription connection",
6+
"type": "object",
7+
"required": [ "reader" ],
8+
"properties": {
9+
"reader": {
10+
"title": "Reader",
11+
"description": "Define how to read messages from a kafka topic",
12+
"$ref": "../../../messaging/kafka/reader.json"
13+
}
14+
},
15+
"patternProperties": {
16+
"^[@$_#]": true
17+
},
18+
"additionalProperties": false
19+
}

v2.13/backend_extra_config.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,12 @@
6868
"backend/pubsub/subscriber": {
6969
"$ref": "backend/pubsub/subscriber.json"
7070
},
71+
"backend/pubsub/publisher/kafka": {
72+
"$ref": "backend/pubsub/kafka/publisher.json"
73+
},
74+
"backend/pubsub/subscriber/kafka": {
75+
"$ref": "backend/pubsub/kafka/subscriber.json"
76+
},
7177
"backend/soap": {
7278
"$ref": "backend/soap.json"
7379
},

0 commit comments

Comments
 (0)