Skip to content

Commit 3467877

Browse files
authored
bridge: Add kafka to example configs, config tests (#1357)
Follow-up to #1333, #1345 which added Kafka support but did not update the example YAML files, or config parsing tests.
2 parents d55d160 + 863e8cb commit 3467877

File tree

3 files changed

+85
-0
lines changed

3 files changed

+85
-0
lines changed

bridge/svix-bridge.example.receivers.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,3 +109,18 @@ receivers:
109109
# - `AWS_SECRET_ACCESS_KEY`
110110
type: "sqs"
111111
queue_dsn: "https://aws.example.com/my-queue"
112+
113+
- name: "forward-to-kafka-example"
114+
input:
115+
type: "webhook"
116+
path_id: "kafka"
117+
verification:
118+
type: "none"
119+
output:
120+
kafka_bootstrap_brokers: "localhost:9094"
121+
kafka_topic: "foobar"
122+
# Other valid values: "plaintext", "ssl"
123+
kafka_security_protocol: "sasl_ssl"
124+
# Only for SASL
125+
kafka_sasl_username: "user"
126+
kafka_sasl_password: "pass"

bridge/svix-bridge.example.senders.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,3 +135,30 @@ senders:
135135
type: "svix"
136136
# Required (the Svix token to use when creating messages with this consumer)
137137
token: "XYZ"
138+
139+
# Kafka Consumer
140+
- name: "kafka-example"
141+
input:
142+
kafka_bootstrap_brokers: "localhost:9094"
143+
kafka_group_id: "kafka_example_consumer_group"
144+
kafka_topic: "foobar"
145+
# Other valid values: "plaintext", "ssl"
146+
kafka_security_protocol: "sasl_ssl"
147+
# Only for SASL
148+
kafka_sasl_username: "user"
149+
kafka_sasl_password: "pass"
150+
# Optional - when unset, messages from the queue will be sent to Svix as-is.
151+
transformation: |
152+
function handler(input) {
153+
return {
154+
appId: input.key,
155+
message: {
156+
eventType: input.event_type,
157+
payload: input.data
158+
}
159+
};
160+
}
161+
output:
162+
type: "svix"
163+
# Required (the Svix token to use when creating messages with this consumer)
164+
token: "XYZ"

bridge/svix-bridge/src/config/tests.rs

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,33 @@ senders:
146146
# Required (the Svix token to use when creating messages with this consumer)
147147
token: "XYZ"
148148
149+
# Kafka Consumer
150+
- name: "kafka-example"
151+
input:
152+
kafka_bootstrap_brokers: "localhost:9094"
153+
kafka_group_id: "kafka_example_consumer_group"
154+
kafka_topic: "foobar"
155+
# Other valid values: "plaintext", "ssl"
156+
kafka_security_protocol: "sasl_ssl"
157+
# Only for SASL
158+
kafka_sasl_username: "user"
159+
kafka_sasl_password: "pass"
160+
# Optional - when unset, messages from the queue will be sent to Svix as-is.
161+
transformation: |
162+
function handler(input) {
163+
return {
164+
appId: input.key,
165+
message: {
166+
eventType: input.event_type,
167+
payload: input.data
168+
}
169+
};
170+
}
171+
output:
172+
type: "svix"
173+
# Required (the Svix token to use when creating messages with this consumer)
174+
token: "XYZ"
175+
149176
150177
# Receivers are HTTP endpoints that can have webhooks sent to them.
151178
# When a webhook is POST'ed to a matching URL, it is (optionally) verified,
@@ -237,6 +264,22 @@ receivers:
237264
# - `AWS_SECRET_ACCESS_KEY`
238265
type: "sqs"
239266
queue_dsn: "https://example.aws.com/my-queue"
267+
268+
- name: "forward-to-kafka-example"
269+
input:
270+
type: "webhook"
271+
path_id: "kafka"
272+
verification:
273+
type: "none"
274+
output:
275+
kafka_bootstrap_brokers: "localhost:9094"
276+
kafka_topic: "foobar"
277+
# Other valid values: "plaintext", "ssl"
278+
kafka_security_protocol: "sasl_ssl"
279+
# Only for SASL
280+
kafka_sasl_username: "user"
281+
kafka_sasl_password: "pass"
282+
240283
"#;
241284

242285
#[test]

0 commit comments

Comments
 (0)