Skip to content

Commit f4a596e

Browse files
committed
override servers
1 parent 29993b2 commit f4a596e

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

packages/service-utils/src/node/kafka.ts

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,6 @@ import {
33
type ProducerGlobalConfig,
44
} from "@confluentinc/kafka-javascript";
55

6-
const KAFKA_URL: Record<"development" | "production", string> = {
7-
development: "warpstream-dev.thirdweb.xyz:9092",
8-
production: "warpstream.thirdweb.xyz:9092",
9-
} as const;
10-
116
/**
127
* Reference: https://kafka.js.org/docs/producing#producing-messages
138
*/
@@ -44,9 +39,9 @@ export class KafkaProducer {
4439
*/
4540
producerName: string;
4641
/**
47-
* The environment the service is running in.
42+
* A comma-separated list of `host[:port]` Kafka servers.
4843
*/
49-
environment: "development" | "production";
44+
kafkaServers: string;
5045
username: string;
5146
password: string;
5247

@@ -55,11 +50,11 @@ export class KafkaProducer {
5550
*/
5651
config?: ProducerGlobalConfig;
5752
}) {
58-
const { producerName, environment, username, password, config } = options;
53+
const { producerName, kafkaServers, username, password, config } = options;
5954

6055
this.producer = new KafkaJS.Kafka({}).producer({
61-
"client.id": `${producerName}-${environment}`,
62-
"bootstrap.servers": KAFKA_URL[environment],
56+
"client.id": producerName,
57+
"bootstrap.servers": kafkaServers,
6358
"security.protocol": "sasl_ssl",
6459
"sasl.mechanisms": "PLAIN",
6560
"sasl.username": username,

0 commit comments

Comments
 (0)