Skip to content

Commit 3dbbae5

Browse files
authored
Merge pull request #374 from dmitchsplunk/main
added back the kafka.js file to the otel discovery demo
2 parents 3d30436 + b16270d commit 3dbbae5

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
kafka*
21
nohup.out
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
const { Kafka } = require('kafkajs')
2+
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

Comments
 (0)