GithubHelp home page GithubHelp logo

isabella232 / expandjsonsmt Goto Github PK

View Code? Open in Web Editor NEW

This project forked from condenast/expandjsonsmt

0.0 0.0 0.0 78 KB

Kafka Connect SMT to expand JSON field

License: Apache License 2.0

Java 92.85% Dockerfile 4.88% Shell 2.27%

expandjsonsmt's Introduction

Kafka connect SMT to expand JSON string

This java lib implements Kafka connect SMT (Single Message Transformation) to extract JSON object from input string field.

Config

Use it in connector config file like this:

...
"transforms": "expand",
"transforms.expand.type": "com.redhat.insights.expandjsonsmt.ExpandJSON$Value",
"transforms.expand.sourceFields": "metadata"
...

Use dot notation for deeper fields (e. g. level1.level2).

Install to Kafka Connect

After build copy file target/kafka-connect-smt-expandjsonsmt-0.0.5-assemble-all.jar to Kafka Connect container `` copying to its docker image or so.

It can be done adding this line to Dockerfile:

COPY ./target/kafka-connect-smt-expandjsonsmt-0.0.5-assemble-all.jar $KAFKA_CONNECT_PLUGINS_DIR

Or download current release:

RUN curl -fSL -o /tmp/plugin.tar.gz \
    https://github.com/RedHatInsights/expandjsonsmt/releases/download/0.0.5/kafka-connect-smt-expandjsonsmt-0.0.5.tar.gz && \
    tar -xzf /tmp/plugin.tar.gz -C $KAFKA_CONNECT_PLUGINS_DIR && \
    rm -f /tmp/plugin.tar.gz;

Example

# build jar file and store to target directory
mvn package

# start example containers (kafka, postgres, elasticsearch, ...)
docker-compose up --build

# when containers started run in separate terminal:
cd dev
./connect.sh # init postgres and elasticsearch connectors
./show_topics.sh # check created topic 'dbserver1.public.hosts' in kafka
./show_es.sh # check transformed documents imported from postgres to elasticsearch

# ... stop containers
docker-compose down

Build release file

  • Remove target directory if it exists.
  • Increment version in pom.xml (e.g. to 0.0.3).
  • Run build script: ./scripts/build_release.sh 0.0.3.
  • Take *.tar.gz file from target folder and publish it.

expandjsonsmt's People

Contributors

ckyrouac avatar jharting avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.