Skip to content

exness/java-livecoding

Repository files navigation

Live coding environment for Data Engineer position

Prerequisites

  1. A machine with a working Docker installation
  2. JDK 17 + an IDE for working with Java projects
  3. Gradle >= 7.6 (or you can use the gradle-wrapper (./gradlew) from the repository)
  4. A PostgreSQL client

To verify that the environment works, run:

gradle clean test --tests EnvironmentSetupTest --info

Repository overview

  1. Python producer of quotes and trades /producer
    • Quotes are sent to the ticks topic
    • Trades are sent to the trades topic
    • Used in integration tests
    • The candidate does not need to dig into it
  2. Java project /src
    • Unit and integration tests /src/test
      • EnvironmentSetupTest is an integration test that checks Kafka, the Python producers, and the Java code can work together.
    • models POJO classes for JSON deserialization

Task

You can prepare for the live coding session in advance and do it as "homework":

  1. Complete the following classes com.exness.livecoding.models.Tick, com.exness.livecoding.models.Trade for JSON deserialization, so that these tests pass:
    gradle test --tests com.exness.livecoding.models.TickTest
    gradle test --tests com.exness.livecoding.models.TradeTest
    • JSON examples can be found in the tests, or seen in the logs when running the EnvironmentSetupTest test
    • The class must implement getters for all fields
  2. Write a Kafka consumer that receives and deserializes JSON into the POJO objects implemented in step 1

Local environment (Docker Compose)

Bring up Kafka, PostgreSQL and the Python producers:

docker-compose up -d

Services exposed on the host:

  • Kafka broker — localhost:9092
  • PostgreSQL — localhost:5432, db livecoding, user postgres, password mysecretpassword

The application reads these settings from application.yml (each value can be overridden via environment variables, e.g. KAFKA_BOOTSTRAP_SERVERS, SPRING_DATASOURCE_URL). PostgreSQL is initialized with the schema from init.sql (ticks, trades, trades_enriched tables).

Troubleshooting

Could not find a valid Docker environment when running the Testcontainers tests (even though Docker is up). Recent Docker Desktop defaults to a newer Docker API version that the bundled Testcontainers / docker-java client can fail to negotiate.

Fix: pin a minimum API version in Docker Desktop → Settings → Docker Engine, add "min-api-version": "1.24" to the JSON config, then Apply & Restart:

{
  "min-api-version": "1.24"
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors