Skip to content

Commit 71e1fea

Browse files
committed
bug fix
1 parent e0b74f7 commit 71e1fea

5 files changed

Lines changed: 54 additions & 55 deletions

File tree

manifest/deployments/kafka.yaml

Lines changed: 39 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -15,28 +15,38 @@ spec:
1515
app: kafka
1616
spec:
1717
containers:
18-
- name: kafka
19-
image: bitnami/kafka:latest
20-
ports:
21-
- containerPort: 9092
22-
name: plaintext
23-
env:
24-
- name: KAFKA_CFG_ZOOKEEPER_CONNECT
25-
value: "zookeeper:2181"
26-
- name: ALLOW_PLAINTEXT_LISTENER
27-
value: "yes"
28-
- name: KAFKA_CFG_LISTENERS
29-
value: "PLAINTEXT://:9092"
30-
- name: KAFKA_CFG_ADVERTISED_LISTENERS
31-
value: "PLAINTEXT://kafka:9092"
32-
- name: KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP
33-
value: "PLAINTEXT:PLAINTEXT"
34-
- name: KAFKA_CFG_INTER_BROKER_LISTENER_NAME
35-
value: "PLAINTEXT"
36-
- name: KAFKA_CFG_OFFSETS_TOPIC_REPLICATION_FACTOR
37-
value: "1"
38-
- name: KAFKA_CFG_AUTO_CREATE_TOPICS_ENABLE
39-
value: "true"
18+
- name: kafka
19+
image: bitnami/kafka:latest
20+
ports:
21+
- containerPort: 9092
22+
name: plaintext
23+
- containerPort: 9093
24+
name: controller
25+
env:
26+
- name: ALLOW_PLAINTEXT_LISTENER
27+
value: "yes"
28+
- name: KAFKA_CFG_BROKER_ID
29+
value: "1"
30+
- name: KAFKA_CFG_NODE_ID
31+
value: "1"
32+
- name: KAFKA_CFG_PROCESS_ROLES
33+
value: "broker,controller"
34+
- name: KAFKA_CFG_CONTROLLER_QUORUM_VOTERS
35+
value: "1@kafka:9093"
36+
- name: KAFKA_CFG_LISTENERS
37+
value: "PLAINTEXT://:9092,CONTROLLER://:9093"
38+
- name: KAFKA_CFG_ADVERTISED_LISTENERS
39+
value: "PLAINTEXT://kafka:9092"
40+
- name: KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP
41+
value: "CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT"
42+
- name: KAFKA_CFG_CONTROLLER_LISTENER_NAMES
43+
value: "CONTROLLER"
44+
- name: KAFKA_CFG_INTER_BROKER_LISTENER_NAME
45+
value: "PLAINTEXT"
46+
- name: KAFKA_CFG_OFFSETS_TOPIC_REPLICATION_FACTOR
47+
value: "1"
48+
- name: KAFKA_CFG_AUTO_CREATE_TOPICS_ENABLE
49+
value: "true"
4050
---
4151
apiVersion: v1
4252
kind: Service
@@ -46,8 +56,11 @@ metadata:
4656
app: kafka
4757
spec:
4858
ports:
49-
- port: 9092
50-
targetPort: 9092
51-
name: plaintext
59+
- port: 9092
60+
targetPort: 9092
61+
name: plaintext
62+
- port: 9093
63+
targetPort: 9093
64+
name: controller
5265
selector:
53-
app: kafka
66+
app: kafka

manifest/deployments/zookeeper.yaml

Lines changed: 11 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -15,27 +15,14 @@ spec:
1515
app: zookeeper
1616
spec:
1717
containers:
18-
- name: zookeeper
19-
image: bitnami/zookeeper:latest
20-
ports:
21-
- containerPort: 2181
22-
env:
23-
- name: ZOOKEEPER_CLIENT_PORT
24-
value: "2181"
25-
- name: ZOOKEEPER_TICK_TIME
26-
value: "2000"
27-
- name: ALLOW_ANONYMOUS_LOGIN
28-
value: "yes"
29-
---
30-
apiVersion: v1
31-
kind: Service
32-
metadata:
33-
name: zookeeper
34-
labels:
35-
app: zookeeper
36-
spec:
37-
ports:
38-
- port: 2181
39-
targetPort: 2181
40-
selector:
41-
app: zookeeper
18+
- name: zookeeper
19+
image: bitnami/zookeeper:latest
20+
ports:
21+
- containerPort: 2181
22+
env:
23+
- name: ZOOKEEPER_CLIENT_PORT
24+
value: "2181"
25+
- name: ZOOKEEPER_TICK_TIME
26+
value: "2000"
27+
- name: ALLOW_ANONYMOUS_LOGIN
28+
value: "yes" # This line enables anonymous login

payment-srv/src/application/useCases/enrollStudentInCourseUseCase.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { producer } from "../../infrastructure/kafka";
21
import { sendEnrollPaidUserProducer } from "../../infrastructure/kafka/producers";
32
import { IDependencies } from "../interfaces/IDependencies";
43

@@ -8,7 +7,7 @@ export const enrollStudentInCourseUseCase = (dependencies: IDependencies) => {
87
execute: async (userId: string, courseId: string) => {
98
try {
109
const response = await enrollStudentInCourse(userId,courseId)
11-
console.log("Enrolling student in course.... usecase", userId, courseId, 'and getting response :',response);
10+
console.log("Enrolling student in course.... usecase","userID:=", userId,"COURSE ID =", courseId, 'and getting response :',response);
1211
if(response){
1312
await sendEnrollPaidUserProducer(userId,courseId,"course-srv-topic");
1413
await sendEnrollPaidUserProducer(userId,courseId,"chat-srv-topic");

payment-srv/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { producer } from './infrastructure/kafka';
77
try {
88
Server;
99

10-
await Promise.all([connectDB(),producer.connect(), runConsumer()])
10+
await Promise.all([connectDB(), runConsumer()])
1111
// TODO: disconnected the consumer reconnect it when needed
1212
.then(() => {
1313
console.log("kafka consumer is running")

payment-srv/src/presentation/controllers/createSessionController.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ export const createSessionController = (dependencies: IDependencies) => {
6969
quantity: 1,
7070
},
7171
],
72-
success_url: `${process.env.FRONTEND_URL}/payment/success/courseId=${course._id}`,
73-
cancel_url: `${process.env.FRONTEND_URL}/payment/failed/courseId=${course._id}`,
72+
success_url: `${process.env.FRONTEND_URL}/payment/success/courseId=${course?._id}`,
73+
cancel_url: `${process.env.FRONTEND_URL}/payment/failed/courseId=${course?._id}`,
7474
});
7575

7676
// **Update the session's metadata with the session ID**

0 commit comments

Comments
 (0)