Skip to content

lefebsy/json2kafka

Repository files navigation

Build Status GitHub release (latest SemVer) Docker Image Version (latest semver) Gitpod ready-to-code

REST microService : Json to Kafka

Main features

  • Designed for kubernetes, all settings can be setted by environnements variables or a configmap appsettings.json file
  • Liveness and readiness probes ready /health
  • Can publish on a Kafka with TLS and Sasl username/password
  • The REST API can be exposed with a simple basicAuth login/password
  • Logs JSON formated compliant with kubernetes annotations elastic.co to be parsed and displayed in Kibana

How to use

  • Method : POST
  • URI : /api/msg
  • Content-Type : application/json
  • Format : UTF-8
  • Body : Json document
  • [BasicAuth] : username and password header

Example :

curl -u admin:admin -H "Content-Type: application/json" -X POST https://5001-host-xyz.gitpod.io/api/msg -d '{"key1":"value1", "key2":"value2"}'

From Gitpod terminal :

J2K_URL=$(gp url 5001)
curl -u admin:admin -H "Content-Type: application/json" -X POST $J2K_URL/api/msg -d '{"key1":"value1", "key2":"value2"}'

Configuration

Kubernetes deployement

See manifest.yml for a basic example

It is not !

  • There is NO authentication impersonation, REST credentials are not played as Kafka credentials
  • This code is not fully tested, it is a very simple project to test Kafka in dotnetCore microservice