Local Development - munichbughunter/SevenFacette GitHub Wiki
Initial local setup for development
If you want to develop 7Facette you have to do the following setup steps.
- clone this repository
- modify build.gradle file in core module. Define a version in line 118 like the pattern: "v1.0.0"
- comment out line 120
- modify build.gradle file in web module. Define a version in line 118 like the pattern: "v1.0.0"
- comment out line ~120
- on the root execute: gradle clean build -x jsNodeTest
- the first build will be failed - you have no core version in your local maven
- execute gradle task: publishJvmPublicationToMavenLocal
Now you are able to bind the builded dependency from your local maven and can check the functionality and so on.
Use package for local js test
Build the package
If you change/ create functions in the js-part of the repository and you want to test the created changes locally perform the following steps:
Run gradle clean build -x test
.
This results in a folder "build" in the root-folder. Inside this folder, you find a folder "js/packages". Inside this folder is a file "SevenFacette-core.js". This file contains all js-code created by the build and contains also all the changes.
Use the package
Now create a new file inside the js-example-folder. Inside the file import the js-file and add the path inside the file. E.g.:
const sfConfig = require('../build/js/packages/SevenFacette-core').de.p7s1.qa.sevenfacette.config;
After that you can use the created code, e.g.:
var config = new sfConfig.types.KafkaTopicConfig();
config.autoOffset = true;
config.bootstrapServer = 'localhost:9092';
Docker container for a single node Kafka broker
After the following this page it should be possible to bring up a dockerized Kafka broker and run some easy tests.
How to bring up the container using the compose file?
- Clone this repo
- Go to the zerocode-docker-factory/compose dir in a terminal window
- Run the following command: docker-compose -f kafka-single-node-yml up -d
This brings up both Zookeeper and Kafka server/broker
How to check the status of Kafka and Zookeeper?
When you run the command docker ps you should see something like the following
docker ps
CONTAINER ID IMAGE PORTS NAMES
4e2d04972db8 confluentinc/cp-kafka:5.0.1 0.0.0.0:9092->9092/tcp compose_kafka_1
825a1c3bc048 confluentinc/cp-zookeeper:5.0.1 2181/tcp, 2888/tcp, 3888/tcp compose_zookeeper_1
Note-
See under the "NAMES" column(right hand ride) above, for `compose_kafka_1` as container name
and the "PORTS" column to see which port the container is listening to for the external listeners.
Verify the port has been exposed outside the docker container
To make sure that the Kafka broker is running and the port 9092 has exposed to an external client outside the docker run the following command:
nc -vz localhost 9092
You should get an answer like this:
Connection to localhost port 9092 [tcp/XmlIpcRegSvc] succeeded!
Note: If a port is not exposed, you will get the following message:
nc: connectx to localhost port 9093 (tcp) failed: Connection refused
nc: connectx to localhost port 9093 (tcp) failed: Connection refused
Verify that a message can be produced to and consumed from a topic
First, we will verify that we can produce a message manually by hand. For that go into the container
docker exec -it compose_kafka_1 bash root@4e2d04972db8:/#
Now you can produce a message to a topic, here we use a topic with the name test
` echo "test-XYZ" | kafka-console-producer --broker-list kafka:29092 --topic test If you see no error means, it might be produced correctly
If you see the following warning you can ignore them and try to send the message again:
[2020-10-14 06:55:10,290] WARN [Producer clientId=console-producer] Error while fetching metadata with correlation id 1 : {test=LEADER_NOT_AVAILABLE} (org.apache.kafka.clients.NetworkClient) `
For consuming a message from a topic, like a test
` root@4e2d04972db8:/# kafka-console-consumer --bootstrap-server kafka:29092 --topic test --from-beginning test-XYZ
Press Ctrl+c to stop this process and come to the command prompt `
Bring down the containers once you are done with your testing
docker-compose -f kafka-single-node.yml down