From d165b4d8a3478b51248b8010ebf9442829e9bff0 Mon Sep 17 00:00:00 2001 From: Mostafa Moradian Date: Tue, 7 Jun 2022 12:24:14 +0200 Subject: [PATCH] Update README after release --- README.md | 56 ++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 35 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 73fba79..481d2b4 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ The xk6-kafka project is a [k6 extension](https://k6.io/docs/extensions/guides/w The real purpose of this extension is to test the system you meticulously designed to use Apache Kafka. So, you can test your consumers, and hence your system, by auto-generating messages and sending them to your system via Apache Kafka. -You can send many messages with each connection to Kafka. These messages are arrays of objects containing a key and a value in various serialization formats, passed via configuration objects. Various serialization formats, including strings, JSON, binary, Avro and JSONSchema, are supported. Avro schema and JSONSchema can either be fetched from Schema Registry or hard-code directly in the script. SASL PLAIN/SCRAM authentication and message compression are also supported. +You can send many messages with each connection to Kafka. These messages are arrays of objects containing a key and a value in various serialization formats, passed via configuration objects. Various serialization formats, including strings, JSON, binary, Avro and JSON Schema, are supported. Avro and JSON Schema can either be fetched from Schema Registry or hard-code directly in the script. SASL PLAIN/SCRAM authentication and message compression are also supported. For debugging and testing purposes, a consumer is available to make sure you send the correct data to Kafka. @@ -14,8 +14,8 @@ If you want to learn more about the extension, see the [article](https://k6.io/b ## Supported Features -- Produce/consume messages as [String](https://github.com/mostafa/xk6-kafka/blob/main/scripts/test_json.js), [stringified JSON](https://github.com/mostafa/xk6-kafka/blob/main/scripts/test_json.js), [ByteArray](https://github.com/mostafa/xk6-kafka/blob/main/scripts/test_bytes.js), [Avro](https://github.com/mostafa/xk6-kafka/blob/main/scripts/test_avro_with_schema_registry.js) and [JSONSchema](https://github.com/mostafa/xk6-kafka/blob/main/scripts/test_jsonschema_with_schema_registry.js) format -- Support for user-provided [Avro](https://github.com/mostafa/xk6-kafka/blob/main/scripts/test_avro.js) and [JSONSchema](https://github.com/mostafa/xk6-kafka/blob/main/scripts/test_jsonschema_with_schema_registry.js) key and value schemas in the script +- Produce/consume messages as [String](https://github.com/mostafa/xk6-kafka/blob/main/scripts/test_json.js), [stringified JSON](https://github.com/mostafa/xk6-kafka/blob/main/scripts/test_json.js), [ByteArray](https://github.com/mostafa/xk6-kafka/blob/main/scripts/test_bytes.js), [Avro](https://github.com/mostafa/xk6-kafka/blob/main/scripts/test_avro_with_schema_registry.js) and [JSON Schema](https://github.com/mostafa/xk6-kafka/blob/main/scripts/test_jsonschema_with_schema_registry.js) format +- Support for user-provided [Avro](https://github.com/mostafa/xk6-kafka/blob/main/scripts/test_avro.js) and [JSON Schema](https://github.com/mostafa/xk6-kafka/blob/main/scripts/test_jsonschema_with_schema_registry.js) key and value schemas in the script - Authentication with [SASL PLAIN and SCRAM](https://github.com/mostafa/xk6-kafka/blob/main/scripts/test_sasl_auth.js) - Create, list and delete [topics](https://github.com/mostafa/xk6-kafka/blob/main/scripts/test_topics.js) - Support for loading Avro schemas from [Schema Registry](https://github.com/mostafa/xk6-kafka/blob/main/scripts/test_avro_with_schema_registry.js) @@ -25,6 +25,7 @@ If you want to learn more about the extension, see the [article](https://k6.io/b - Support for sending messages with [no key](https://github.com/mostafa/xk6-kafka/blob/main/scripts/test_avro_no_key.js) - Support for k6 [thresholds](https://github.com/mostafa/xk6-kafka/blob/e1a810d52112f05d7a66c12740d9885ebb64897e/scripts/test_json.js#L21-L27) on custom Kafka metrics - Support for [headers](https://github.com/mostafa/xk6-kafka/blob/main/scripts/test_json.js) on produced and consumed messages +- Lots of exported metrics, as shown in the result output of the [k6 test script](#k6-test-script) ## Backward Compatibility Notice @@ -44,6 +45,10 @@ Since [v0.8.0](https://github.com/mostafa/xk6-kafka/releases/tag/v0.8.0), there docker run --rm -i mostafamoradian/xk6-kafka:latest run - error {} +function consume(reader: object, limit: number, keySchema: string, valueSchema: string) => [[object], error] {} /** * Read a sequence of messages from Kafka. * * @function - * @param {object} reader The reader object created with the reader constructor. - * @param {number} limit How many messages should be read in one go, which blocks. Defaults to 1. - * @param {string} configurationJson Serializer, deserializer and schemaRegistry configuration. - * @param {string} keySchema An optional Avro/JSONSchema schema for the key. - * @param {string} valueSchema An optional Avro/JSONSchema schema for the value. - * @returns {object} A error object. + * @param {object} reader The reader object created with the reader constructor. + * @param {number} limit How many messages should be read in one go, which blocks. Defaults to 1. + * @param {string} configurationJson Serializer, deserializer and schemaRegistry configuration. + * @param {string} keySchema An optional Avro/JSONSchema schema for the key. + * @param {string} valueSchema An optional Avro/JSONSchema schema for the value. + * @returns {[[object], error]} An array of two objects: an array of objects and an error object. Each message object can contain a value and an optional set of key, topic, partition, offset, time, highWaterMark and headers. Headers are objects. */ -function consumeWithConfiguration(reader: object, limit: number, configurationJson: string, keySchema: string, valueSchema: string) => error {} +function consumeWithConfiguration(reader: object, limit: number, configurationJson: string, keySchema: string, valueSchema: string) => [[object], error] {} /** * Create a topic in Kafka. It does nothing if the topic exists.