File tree Expand file tree Collapse file tree 3 files changed +43
-0
lines changed
Expand file tree Collapse file tree 3 files changed +43
-0
lines changed Original file line number Diff line number Diff line change 1+ import kafka from "./client" ;
2+
3+ ( async ( ) => {
4+ const admin = kafka . admin ( ) ;
5+ await admin . connect ( ) ;
6+ await admin . createTopics ( {
7+ topics : [
8+ {
9+ topic : "events.cloudevents.test" ,
10+ numPartitions : 2 ,
11+ } ,
12+ ] ,
13+ } ) ;
14+ await admin . disconnect ( ) ;
15+ } ) ( ) ;
Original file line number Diff line number Diff line change 1+ import "dotenv/config" ;
2+ import { Kafka } from "kafkajs" ;
3+
4+ const kafka = new Kafka ( {
5+ clientId : 'kafka-ex-client-id' ,
6+ brokers : [ 'localhost:9092' ] ,
7+ } ) ;
8+
9+ export default kafka ;
Original file line number Diff line number Diff line change 1+ {
2+ "compilerOptions" : {
3+ "target" : " ES2020" ,
4+ "module" : " commonjs" ,
5+ "allowJs" : true ,
6+ "checkJs" : false ,
7+ "strict" : true ,
8+ "noImplicitAny" : true ,
9+ "moduleResolution" : " node" ,
10+ "esModuleInterop" : true ,
11+ },
12+ "include" : [
13+ " src/**/*.ts" ,
14+ " src/**/*.js"
15+ ],
16+ "exclude" : [
17+ " node_modules"
18+ ]
19+ }
You can’t perform that action at this time.
0 commit comments