Home

Awesome

JSON Event Sourcing Fanout Service

This microservice sends messages from Kafka topics to the fanout.io service. The topics should use the serialisation of JSON Event Sourcing. The usernames from the messages are used for the channel names. They are extracted from the _jwt/sub and _subscriptions/sub fields.

Configuration

The configuration is managed by the Lightbend Config package. By default it will try to load conf/application.conf. An alternative configuration may be loaded by adding -Dconfig.resource=myconfig.conf, where the file is also supposed to be in the conf directory. The following entries are available.

EntryDescription
environmentThe name of the environment, e.g. "tst", "prd".
kafkaAll Kafka settings come below this entry. So for example, the setting bootstrap.servers would go to the entry kafka.bootstrap.servers.
kafka.num.stream.threadsThe number of worker threads per instance.
kafka.replication.factorWhen using Confluent Cloud this should be 3.
logLevelThe log level as defined in java.util.logging.Level.
logTopicThe Kafka topic where the errors will be logged in the Elastic Common Schema.
realmInThe realm ID for the fanout.io service.
realmKeyThe realm key for the fanout.io service.
topicsThe list of Kafka topics from which messages should be propagated.
topologyTopicWhen that Kafka topic is set topology life cycle events will be sent to it.

Building and Running

You can build the tool with mvn clean package. This will produce a self-contained JAR-file in the target directory with the form pincette-jes-fanout-<version>-jar-with-dependencies.jar. You can launch this JAR with java -jar, without further options.

The total number of threads across all the instances should not exceed the number of partitions for the Kafka topics. Additional threads will be idle.

You can run the JVM with the option -mx128m.

Docker

Docker images can be found at https://hub.docker.com/repository/docker/jsoneventsourcing/pincette-jes-fanout. You should add a configuration layer with a Docker file that looks like this:

FROM registry.hub.docker.com/jsoneventsourcing/pincette-jes-fanout:<version>
COPY conf/tst.conf /conf/application.conf

So wherever your configuration file comes from, it should always end up at /conf/application.conf.