kafka-console 2.0.0 → 2.0.1

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/README.md CHANGED
@@ -41,7 +41,7 @@ npm install -g kafka-console
41
41
  -b, --brokers <brokers> bootstrap server host (default: "localhost:9092")
42
42
  -l, --log-level <logLevel> log level
43
43
  -t, --timeout <timeout> set a timeout of operation (default: "0")
44
- -p, --pretty pretty print json
44
+ -p, --pretty pretty print (default: false)
45
45
  --ssl enable ssl (default: false)
46
46
  --mechanism <mechanism> sasl mechanism
47
47
  --username <username> sasl username
@@ -62,8 +62,9 @@ npm install -g kafka-console
62
62
  metadata Displays kafka server metadata
63
63
  list|ls [options] Lists kafka topics
64
64
  config [options] Describes config for specific resource
65
- create <topic> Creates kafka topic
66
- delete <topic> Deletes kafka topic
65
+ topic:create <topic> Creates kafka topic
66
+ topic:delete <topic> Deletes kafka topic
67
+ topic:offsets <topic> [timestamp] Shows kafka topic offsets
67
68
  help [command] display help for command
68
69
  ```
69
70
 
@@ -73,13 +74,13 @@ npm install -g kafka-console
73
74
 
74
75
  #### Options
75
76
  ```
76
- -g, --group <group> consumer group name
77
- -f, --format <format> message type decoding json, js, raw (default: "json")
78
- -o, --output <filename> write output to specified filename
79
- -a, --from-beginning read messages from the beginning (default: false)
80
- -c, --count <count> a number of messages to read (default: null)
81
- -s, --skip <skip> a number of messages to skip (default: 0)
82
- -h, --help display help for command
77
+ -g, --group <group> consumer group name (default: "kafka-console-consumer-TIMESTAMP")
78
+ -d, --data-format <data-format> messages data-format: json, js, raw (default: "json")
79
+ -o, --output <filename> write output to specified filename
80
+ -f, --from <from> read messages from the specific timestamp in milliseconds or ISO 8601 format. Set 0 to read from the beginning
81
+ -c, --count <count> a number of messages to read (default: null)
82
+ -s, --skip <skip> a number of messages to skip (default: 0)
83
+ -h, --help display help for command
83
84
  ```
84
85
 
85
86
  General usage with authentication
@@ -87,14 +88,14 @@ General usage with authentication
87
88
  kcli consume $KAFKA_TOPIC -g $KAFKA_TOPIC_GROUP -b $KAFKA_BROKERS --ssl --mechanism plain --username $KAFKA_USERNAME --password $KAFKA_PASSWORD
88
89
  ```
89
90
 
90
- Stdout `jq` example
91
+ Stdout from timestamp `jq` example
91
92
  ```sh
92
- kcli consume $KAFKA_TOPIC | jq .value
93
+ kcli consume $KAFKA_TOPIC --from '1970-01-01T00:00:00.000Z' | jq .value
93
94
  ```
94
95
 
95
96
  Custom data formatter example
96
97
  ```sh
97
- kcli consume $KAFKA_TOPIC --format ./formatter/avro.js | jq
98
+ kcli consume $KAFKA_TOPIC --data-format ./formatter/avro.js | jq
98
99
  ```
99
100
 
100
101
  ### Producer
@@ -103,11 +104,11 @@ kcli consume $KAFKA_TOPIC --format ./formatter/avro.js | jq
103
104
 
104
105
  #### Options
105
106
  ```
106
- -f, --format <format> message format encoding json, js, raw (default: "json")
107
- -i, --input <filename> input filename
108
- -d, --delay <delay> delay in ms after event emitting (default: 0)
109
- -h, --header <header> set a static header (default: [])
110
- --help display help for command
107
+ -d, --data-format <data-format> messages data-format: json, js, raw (default: "json")
108
+ -i, --input <filename> input filename
109
+ -w, --wait <wait> wait the time in ms after sending a message (default: 0)
110
+ -h, --header <header> set a static header (default: [])
111
+ --help display help for command
111
112
  ```
112
113
 
113
114
  General usage
@@ -117,7 +118,7 @@ kcli produce $KAFKA_TOPIC -b $KAFKA_BROKERS --ssl --mechanism plain --username $
117
118
 
118
119
  Produce a json data from stdin with custom formatter
119
120
  ```sh
120
- cat payload.txt|kcli produce $KAFKA_TOPIC --format ./formatter/avro.js
121
+ cat payload.txt|kcli produce $KAFKA_TOPIC --data-format ./formatter/avro.js
121
122
  ```
122
123
 
123
124
  Produce a json data from stdin
@@ -84,7 +84,7 @@ function getInput(filename) {
84
84
  function produce(topic_1, opts_1, _a) {
85
85
  return __awaiter(this, arguments, void 0, function* (topic, opts, { parent }) {
86
86
  var _b, e_1, _c, _d;
87
- const _e = Object.assign(Object.assign({}, parent.opts()), opts), { dataFormat, header, input: filename, delay, brokers, logLevel, ssl } = _e, rest = __rest(_e, ["dataFormat", "header", "input", "delay", "brokers", "logLevel", "ssl"]);
87
+ const _e = Object.assign(Object.assign({}, parent.opts()), opts), { dataFormat, header, input: filename, wait, brokers, logLevel, ssl } = _e, rest = __rest(_e, ["dataFormat", "header", "input", "wait", "brokers", "logLevel", "ssl"]);
88
88
  const sasl = (0, kafka_1.getSASL)(rest);
89
89
  const client = (0, kafka_1.createClient)(brokers, ssl, sasl, logLevel);
90
90
  const producer = yield (0, kafka_1.createProducer)(client, topic);
@@ -108,7 +108,7 @@ function produce(topic_1, opts_1, _a) {
108
108
  const encodedValue = yield formatter.encode(value);
109
109
  const message = { key, value: encodedValue, headers: Object.assign(Object.assign({}, staticHeaders), headers) };
110
110
  producer.push(message);
111
- yield new Promise(resolve => setTimeout(resolve, delay));
111
+ yield new Promise(resolve => setTimeout(resolve, wait));
112
112
  }
113
113
  }
114
114
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
package/build/index.js CHANGED
@@ -53,7 +53,7 @@ commander
53
53
  .command('produce <topic>')
54
54
  .option('-d, --data-format <data-format>', 'messages data-format: json, js, raw', 'json')
55
55
  .option('-i, --input <filename>', 'input filename')
56
- .option('-d, --delay <delay>', 'delay in ms after event emitting', toInt, 0)
56
+ .option('-w, --wait <wait>', 'wait the time in ms after sending a message', toInt, 0)
57
57
  .option('-h, --header <header>', 'set a static header', collect, [])
58
58
  .description('Produce kafka topic events')
59
59
  .action(produce_1.default);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kafka-console",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "description": "Kafka CLI tool",
5
5
  "main": "index.js",
6
6
  "bin": {