We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 3d30436 + b16270d commit 3dbbae5Copy full SHA for 3dbbae5
workshop/demos/otel-discovery-demo/.gitignore
@@ -1,2 +1 @@
1
-kafka*
2
nohup.out
workshop/demos/otel-discovery-demo/src/riskservice/kafka.js
@@ -0,0 +1,16 @@
+const { Kafka } = require('kafkajs')
+
3
+const { KAFKA_USERNAME: username, KAFKA_PASSWORD: password } = process.env
4
+const sasl = username && password ? { username, password, mechanism: 'plain' } : null
5
+const ssl = !!sasl
6
7
+// This creates a client instance that is configured to connect to the Kafka broker provided by
8
+// the environment variable KAFKA_BOOTSTRAP_SERVER
9
+const kafka = new Kafka({
10
+ clientId: 'risk-service',
11
+ brokers: [process.env.KAFKA_BROKER],
12
+ ssl,
13
+ sasl
14
+})
15
16
+module.exports = kafka
0 commit comments