The Merlin SoS message transformation service receives data from the Kafka input
topics, determines the
content-type of the message, transforms its contents to JSON
and then routes both the XML
and JSON
data to the
appropriate topics. This service also ensures that the required topics are in-place at start-up.
This service consists of 2 containers.
sos-transformer-initializer
simply creates the topics thatsos-transformer-service
depends on and then exits.sos-transformer-service
is a long-running process that completes the actual transformations and routes messages between topics.kubernetes
-Kubernetes
artifacts
Both of these containers are Spring Boot
applications which are deployed in Kubernetes
. The containers are built
using the jib
plugin for Maven
.
The application configuration is handled through a Kubernetes
ConfigMap
which is automatically read in by Spring Boot
at deployment time. The following properties are supported:
- [required]
mil.dia.merlin.sos.kafka.bootstrap-server
: theDNS
name of theKafka
bootstrap server to connect to. - [default 1]
mil.dia.merlin.sos.kafka.partition-count
: the number of partitions for each created topic. - [default 1]
mil.dia.merlin.sos.kafka.replica-count
: the number of partition replicas to create across the cluster. This number can't exceed the number of nodes in the cluster.
The project uses these modules:
spring-boot-starter-actuator
- This module allows us to monitor the service health and metrics throughHTTP
.spring-kafka
- a Spring library for connecting toKafka
and using it in a Spring-like fashion.
To build both services from the parent directory:
mvn clean install
This will create 2 Docker
container images on the local machine. The container names are:
- registry.localdev.me/sos-transformer-initializer
- registry.localdev.me/sos-transformer-service
For local development and testing, the process for making the built images available to the kubernetes
cluster is
dependent upon the Kubernetes
Note: If you're running on Docker Desktop then this step is not required.
$ docker push registry.localdev.me/sos-transformer-initializer:latest
$ docker push registry.localdev.me/sos-transformer-service:latest
$ docker save --output target/sos-transformer-initializer-latest.tar registry.localdev.me/sos-transformer-initializer:latest
$ docker save --output target/sos-transformer-service-latest.tar registry.localdev.me/sos-transformer-service:latest
$ sudo k3s ctr images import target/sos-transformer-initializer-latest.tar
$ sudo k3s ctr images import target/sos-transformer-service-latest.tar
$ kubectl apply -f src/main/kubernetes/sos-transformation-service.yaml
It can be removed with:
$ kubectl delete -f src/main/kubernetes/sos-transformation-service.yaml