Skip to content

bastman/codechallenge-watermark-service

Repository files navigation

Code Challenge: Watermark Service

Run

$ ./gradlew bootRun

... and then open http://localhost:8080 in your browser

Test

$ ./gradlew clean build test

Api Endpoints

- POST /api/watermark-job/submit
- GET /api/watermark-job/{ticketId}/status
- GET /api/watermark-job/{ticketId}/download

Gradle Modules

  • rest-service: contains spring-boot application
  • common: contains core domain logic (no dependency to spring)

Coding flavour

  • (threadsafe) immutable data structures
  • sealed class hierarchies
  • composition over inheritance
  • functional over classic oop-style

Features

  • spring boot, swagger-ui, undertow, jackson, caffeine, junit5
  • gradle-multimodule-project (common, rest-service)
    • the core domain logic resides in common-module
    • you may want to reuse core domain logic within different services/projects (e.g. a kafka-based pipeline)

Testing

Concurrency

Drawbacks (Things that can be improved)

  • the solution provided will not scale horizontally, since:

    • application uses local in-memory-cache
    • there is no chance to re-process jobs (in case of failure/re-deploy)

    => a kafka-based solution with dedicated microservices (api, job-processor) is preferable for real-world deployments => https://github.com/bastman/codechallenge-watermark-service-kafka

  • api's are not secured by any auth-strategy

  • submit-api currently does not check for having enough capacity to add new jobs

  • no request validation

  • no proper exception handling

Why Kotlin? Kotlin ...

  • is like SWIFT (ios)
  • is like Scala, but easy to learn
  • is much more type safe than Java - No NullPointerException ;)
  • is fully compatible to Java, but less verbose
  • has first class support for closures
  • is based on "Effective Java"
  • is used in production, by e.g. JetBrains
  • coding is pure fun :)

Kotlin extensions are available for

About

a code challenge of a restish microservice (spring boot, golang-like coroutines & channels)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages