kafka-console 1.3.17 → 1.3.19
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/commands/consume.js +8 -13
- package/build/commands/produce.js +6 -11
- package/build/utils/kafka.js +6 -11
- package/build/utils/pool.js +3 -8
- package/package.json +1 -1
|
@@ -69,21 +69,16 @@ function consume(topic, opts, { parent }) {
|
|
|
69
69
|
});
|
|
70
70
|
const formatter = (0, formatters_1.getFormatter)(format);
|
|
71
71
|
try {
|
|
72
|
-
for (var _e = true, consumer_1 = __asyncValues(consumer), consumer_1_1; consumer_1_1 = yield consumer_1.next(), _a = consumer_1_1.done, !_a;) {
|
|
72
|
+
for (var _e = true, consumer_1 = __asyncValues(consumer), consumer_1_1; consumer_1_1 = yield consumer_1.next(), _a = consumer_1_1.done, !_a; _e = true) {
|
|
73
73
|
_c = consumer_1_1.value;
|
|
74
74
|
_e = false;
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
output.write(JSON.stringify(message, null, space) + '\n');
|
|
83
|
-
}
|
|
84
|
-
finally {
|
|
85
|
-
_e = true;
|
|
86
|
-
}
|
|
75
|
+
let { message: { headers, key, value } } = _c;
|
|
76
|
+
const parsedHeaders = Object.entries(headers).reduce((result, [key, value]) => {
|
|
77
|
+
return Object.assign(Object.assign({}, result), { [key]: value.toString() });
|
|
78
|
+
}, {});
|
|
79
|
+
const message = { headers: parsedHeaders, key: key === null || key === void 0 ? void 0 : key.toString(), value: yield formatter.decode(value) };
|
|
80
|
+
const space = pretty ? 2 : 0;
|
|
81
|
+
output.write(JSON.stringify(message, null, space) + '\n');
|
|
87
82
|
}
|
|
88
83
|
}
|
|
89
84
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
@@ -101,19 +101,14 @@ function produce(topic, opts, { parent }) {
|
|
|
101
101
|
const formatter = (0, formatters_1.getFormatter)(format);
|
|
102
102
|
const input = yield getInput(filename);
|
|
103
103
|
try {
|
|
104
|
-
for (var _e = true, input_1 = __asyncValues(input), input_1_1; input_1_1 = yield input_1.next(), _a = input_1_1.done, !_a;) {
|
|
104
|
+
for (var _e = true, input_1 = __asyncValues(input), input_1_1; input_1_1 = yield input_1.next(), _a = input_1_1.done, !_a; _e = true) {
|
|
105
105
|
_c = input_1_1.value;
|
|
106
106
|
_e = false;
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
yield new Promise(resolve => setTimeout(resolve, delay));
|
|
113
|
-
}
|
|
114
|
-
finally {
|
|
115
|
-
_e = true;
|
|
116
|
-
}
|
|
107
|
+
let { key, value, headers } = _c;
|
|
108
|
+
const encodedValue = yield formatter.encode(value);
|
|
109
|
+
const message = { key, value: encodedValue, headers: Object.assign(Object.assign({}, staticHeaders), headers) };
|
|
110
|
+
producer.push(message);
|
|
111
|
+
yield new Promise(resolve => setTimeout(resolve, delay));
|
|
117
112
|
}
|
|
118
113
|
}
|
|
119
114
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
package/build/utils/kafka.js
CHANGED
|
@@ -141,19 +141,14 @@ function createProducer(client, topic) {
|
|
|
141
141
|
(() => __awaiter(this, void 0, void 0, function* () {
|
|
142
142
|
var _a, e_1, _b, _c;
|
|
143
143
|
try {
|
|
144
|
-
for (var _d = true, pool_2 = __asyncValues(pool), pool_2_1; pool_2_1 = yield pool_2.next(), _a = pool_2_1.done, !_a;) {
|
|
144
|
+
for (var _d = true, pool_2 = __asyncValues(pool), pool_2_1; pool_2_1 = yield pool_2.next(), _a = pool_2_1.done, !_a; _d = true) {
|
|
145
145
|
_c = pool_2_1.value;
|
|
146
146
|
_d = false;
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
finally {
|
|
155
|
-
_d = true;
|
|
156
|
-
}
|
|
147
|
+
let message = _c;
|
|
148
|
+
yield producer.send({
|
|
149
|
+
topic,
|
|
150
|
+
messages: [message],
|
|
151
|
+
});
|
|
157
152
|
}
|
|
158
153
|
}
|
|
159
154
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
package/build/utils/pool.js
CHANGED
|
@@ -72,16 +72,11 @@ class Pool {
|
|
|
72
72
|
return __awaiter(this, void 0, void 0, function* () {
|
|
73
73
|
const result = [];
|
|
74
74
|
try {
|
|
75
|
-
for (var _d = true, _e = __asyncValues(this), _f; _f = yield _e.next(), _a = _f.done, !_a;) {
|
|
75
|
+
for (var _d = true, _e = __asyncValues(this), _f; _f = yield _e.next(), _a = _f.done, !_a; _d = true) {
|
|
76
76
|
_c = _f.value;
|
|
77
77
|
_d = false;
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
result.push(item);
|
|
81
|
-
}
|
|
82
|
-
finally {
|
|
83
|
-
_d = true;
|
|
84
|
-
}
|
|
78
|
+
let item = _c;
|
|
79
|
+
result.push(item);
|
|
85
80
|
}
|
|
86
81
|
}
|
|
87
82
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|