@uber-clone/common 1.0.4 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/events/kafka-client.js +65 -9
- package/package.json +1 -1
|
@@ -11,6 +11,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.KafkaClient = void 0;
|
|
13
13
|
const kafkajs_1 = require("kafkajs");
|
|
14
|
+
const subjects_1 = require("./subjects");
|
|
14
15
|
class KafkaClient {
|
|
15
16
|
constructor() {
|
|
16
17
|
this.isConnected = false;
|
|
@@ -77,15 +78,70 @@ class KafkaClient {
|
|
|
77
78
|
ensureTopics() {
|
|
78
79
|
return __awaiter(this, void 0, void 0, function* () {
|
|
79
80
|
const topics = [
|
|
80
|
-
|
|
81
|
-
{ topic:
|
|
82
|
-
{ topic:
|
|
83
|
-
{ topic:
|
|
84
|
-
{
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
81
|
+
// User events
|
|
82
|
+
{ topic: subjects_1.Subjects.UserCreated, partitions: 3, replicationFactor: 3 },
|
|
83
|
+
{ topic: subjects_1.Subjects.UserUpdated, partitions: 3, replicationFactor: 3 },
|
|
84
|
+
{ topic: subjects_1.Subjects.UserDeleted, partitions: 3, replicationFactor: 3 },
|
|
85
|
+
{
|
|
86
|
+
topic: subjects_1.Subjects.UserProfileUpdated,
|
|
87
|
+
partitions: 3,
|
|
88
|
+
replicationFactor: 3,
|
|
89
|
+
},
|
|
90
|
+
// Auth events
|
|
91
|
+
{ topic: subjects_1.Subjects.UserSignedIn, partitions: 3, replicationFactor: 3 },
|
|
92
|
+
{ topic: subjects_1.Subjects.UserSignedOut, partitions: 3, replicationFactor: 3 },
|
|
93
|
+
{
|
|
94
|
+
topic: subjects_1.Subjects.UserPasswordChanged,
|
|
95
|
+
partitions: 3,
|
|
96
|
+
replicationFactor: 3,
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
topic: subjects_1.Subjects.UserAccountLocked,
|
|
100
|
+
partitions: 3,
|
|
101
|
+
replicationFactor: 3,
|
|
102
|
+
},
|
|
103
|
+
// // Ride events
|
|
104
|
+
// { topic: Subjects.RideRequested, partitions: 6, replicationFactor: 3 },
|
|
105
|
+
// { topic: Subjects.RideAccepted, partitions: 6, replicationFactor: 3 },
|
|
106
|
+
// { topic: Subjects.RideStarted, partitions: 6, replicationFactor: 3 },
|
|
107
|
+
// { topic: Subjects.RideCompleted, partitions: 6, replicationFactor: 3 },
|
|
108
|
+
// { topic: Subjects.RideCancelled, partitions: 6, replicationFactor: 3 },
|
|
109
|
+
// // Driver events
|
|
110
|
+
// { topic: Subjects.DriverOnline, partitions: 6, replicationFactor: 3 },
|
|
111
|
+
// { topic: Subjects.DriverOffline, partitions: 6, replicationFactor: 3 },
|
|
112
|
+
// {
|
|
113
|
+
// topic: Subjects.DriverLocationUpdated,
|
|
114
|
+
// partitions: 12,
|
|
115
|
+
// replicationFactor: 3,
|
|
116
|
+
// },
|
|
117
|
+
// {
|
|
118
|
+
// topic: Subjects.DriverRideAccepted,
|
|
119
|
+
// partitions: 6,
|
|
120
|
+
// replicationFactor: 3,
|
|
121
|
+
// },
|
|
122
|
+
// {
|
|
123
|
+
// topic: Subjects.DriverRideCompleted,
|
|
124
|
+
// partitions: 6,
|
|
125
|
+
// replicationFactor: 3,
|
|
126
|
+
// },
|
|
127
|
+
// // Payment events
|
|
128
|
+
// { topic: Subjects.PaymentInitiated, partitions: 4, replicationFactor: 3 },
|
|
129
|
+
// { topic: Subjects.PaymentCompleted, partitions: 4, replicationFactor: 3 },
|
|
130
|
+
// { topic: Subjects.PaymentFailed, partitions: 4, replicationFactor: 3 },
|
|
131
|
+
// { topic: Subjects.PaymentRefunded, partitions: 4, replicationFactor: 3 },
|
|
132
|
+
// // Notification events
|
|
133
|
+
// {
|
|
134
|
+
// topic: Subjects.NotificationEmail,
|
|
135
|
+
// partitions: 4,
|
|
136
|
+
// replicationFactor: 3,
|
|
137
|
+
// },
|
|
138
|
+
// { topic: Subjects.NotificationSMS, partitions: 4, replicationFactor: 3 },
|
|
139
|
+
// { topic: Subjects.NotificationPush, partitions: 4, replicationFactor: 3 },
|
|
140
|
+
// {
|
|
141
|
+
// topic: Subjects.NotificationInApp,
|
|
142
|
+
// partitions: 4,
|
|
143
|
+
// replicationFactor: 3,
|
|
144
|
+
// },
|
|
89
145
|
];
|
|
90
146
|
try {
|
|
91
147
|
const existingTopics = yield this.admin.listTopics();
|