/live-data-service

Prometheus, Grafana, Kafka, Zipkin, Redis and Elasticsearch Integrations with Spring Boot 3, Java 21 and Docker. Integration Tests with Testcontainers for Controller. Unit Tests for Controller, Service, and Mapper with Junit 5, and Mockito

Primary LanguageJava

Table of Contents

  1. Summary
  2. Prerequisites and Installation
  3. Tech Stack
  4. How To Run And Test Application
  5. How To Run And Test Application with Dockerfile (OPTIONAL)
  6. How To Run And Test Application with docker-compose.yml (OPTIONAL)
  7. Redis Commands
  8. Google Play Integrity API
  9. References

Summary

live-data-service is providing CRUD operations to process live events


Prerequisites

  • Java 21+ needs to be installed export JAVA_HOME=$(/usr/libexec/java_home -v 21)
  • Maven needs to be installed
  • Docker needs to be installed
  • Install any Java IDE (Eclipse, STS, Intellij etc..) and ensure you are able to launch
  • Clone or checkout the project from version control system (git) and follow below steps

Tech_Stack


How_To_Run_And_Test_Application

  • Please follow the following steps, if you want to build and run Spring Boot Application
*** Run the application by following these steps.

1 - cd live-data-service
2 - docker-compose up -d
3 - mvn clean install or mvn clean package 
4 - mvn spring-boot:run

How_To_Run_And_Test_Dockerfile

  • Please follow the following steps, if you want to build and run Dockerfile
1 - cd live-data-service
2 - docker-compose up -d
3 - mvn clean install or mvn clean package --------THIS IS MUST---------
4 - docker build -t mb/live-data-service .
5 - docker run -p 8080:8080 mb/live-data-service

How_To_Run_And_Test_Docker_Compose

  • Please follow the following steps, if you want to build and run docker-compose.yml
  • Remove live-data-service service comment in services section in docker-compose.yml
  • Docker -> Preferences -> Resources -> File sharing -> click add button and select prometheus folder under the /src/main/resources or just add /etc/prometheus path -> Apply & Restart
    • img.png
1 - cd live-data-service
2 - mvn clean install or mvn clean package --------THIS IS MUST---------
3 - docker build -t mb/live-data-service .
4 - docker-compose up -d

Redis

  • The following command returns all matched data by 'keyPattern:*' pattern

    • redis-cli --scan --pattern 'keyPattern:*'
  • The following command deletes all matched data by 'keyPattern:*' pattern

    • redis-cli KEYS 'keyPattern:*' | xargs redis-cli DEL
  • The following command finds TYPE in redis with KEY

    • TYPE key -> TYPE xxx:hashedIdOrSomethingElse
  • The following commands search by TYPE

    • for "string" TYPE: get key
    • for "hash" TYPE: hgetall key
    • for "list" TYPE: lrange key 0 -1
    • for "set" TYPE: smembers key
    • for "zset" TYPE: zrange key 0 -1 withScores
  • RedisInsight: http://localhost:8001/


Google_Play_Integrity_API


References