Kafka-json-processor project generator

This utility can be used to generate a Rust project that can be compiled into an executable with all preconfigured JSON processors. The executable will read from Kafka topic, process the messages and write to another Kafka topic.

The project is generated based on a template. The template is a configuration file instructing the generator how would you like to process the messages.

Preparing template.yml

See the following example of "Example processor" project:

```yaml name: "Example processor" streams: - inputtopic: in outputtopic: out

processors: - generator: staticfield field: $.hello value: world - generator: copyfield sourcefield: $.abc[1] targetfield: $.def ```

In this file, we define one stream that will process messages from "in" topic and put processed messages into "out".

A stream is a single pipeline for processing messages originating from one topic and going into another topic. A single stream contains a list of processors. The processors are functions that will add or change fields to the output message.

In this example, we define two processors: * The first one will add a static_field to the output message. Desired field is defined by JSONPath and the static value is defined by value. * The second one will copy_field from an input message to an output message. It will copy from source_field (defined by JSONPath) to target_field.

Notice that in the template we do not use the term processor, processor kind or processor type to specify what function to use in a pipeline. The reason is that we actually generate the functions for your target project. So this file (template.yml) actually defines how to generate the project, and thus we use different generators for the desired behavior.

What are the generators?

The generators are scripts or executables that output function source based on given parameters. You can write your own script for custom functions. You can also write custom executable (or "plugin" - see kjp-generator-plugin).

Kafka-json-processor has a few ready-to-use generators - you can use kjp-generator-generators.

By default, kjp-generator uses "./generators" path for finding available generators. If you wish to specify a custom path, use this argument option:

```text -g, --generators-path Custom path to processor generators.

      Put all processor generators in this directory. This directory will be scanned for available files and those files will be used as executable plugins to generate any code requested by `generator` option in your `template.yaml`.

      [default: ./generators]

```

Example: ./kjp-generator -g ./kjp-generator-generators -t ./template.yml -o output-directory

How to generate a project?

You will need: * a template (template.yml), * a kjp-generator executable, * generators (eg. kjp-generator-generators).

Run kjp-generator with the following required options:

```text -t, --template