Git Product home page Git Product logo

reactive-workshop's Introduction

Backend Challenge

Story

You work for the Music Artist company as a backend developer. This company owns the largest database referencing music artists all around planet Earth.

You are part of the Music Artist API Team which develops various APIs to access to the artist database. A new Product Owner has been recently hired and has just presented the new Roadmap for the next weeks.

A new partnership has just been setup with the Music Fans Social Network. This platform allows music fans to post comments about their favorite artists. The partnership will be announced soon with a lot of advertising and on your company side, it has been decided to quickly provide some fan comments along with artist information through the API you are working on.

Your mission is to update the existing API to add the comments to artist info. In addition, new streaming API will be added as part of the initiative.

Technical Overview

There are 2 components

macro architecture

external-service

It simulates an external (distant) REST service. There is no need to modify it as part of this challenge.

It runs on port 3004 by default and provides comments API

See com.bonitasoft.reactiveworkshop.external.ExternalApplication

backend

The backend to work on.

It runs on port 8080

How to run

The only requirement is JDK 11.

IDE configuration

The projects use Lombok for code generation. In order to make the projects build in your IDE

external-service

Run the external-service with command ./gradlew :external-service:bootRun

It will launch the spring boot application on http://localhost:3004/

Try this url to verify it works

backend

Run the backend with command ./gradlew :backend:bootRun

It will serve the application on http://localhost:8080/

Try this url to verify it works (it contains currently a large amount of artists)

In the current state, it uses an embedded h2 database

What to do

ℹī¸ All code produced must be production-ready.

Add a new API method that returns one artist and its 10 last comments

It should be called on this URL: http://localhost:8080/artist/{artistId}/comments

and should return something like

{ 
  "artistId": "dfjksl342f32",
  "artistName": "Radiohead",
  "genre": "Rock",
  "comments": [
      {
        "userName": "johndoe",
        "comment": "Nice band!"
      },
      {
        "userName": "walterbates",
        "comment": "It rocks"
      }
  ]
}

Add a new API method that return a stream of comments and associated artists filtered by a genre name

It should be called on this URL: http://localhost:8080/genre/{genre}/comments/stream

and return an infinite stream of json like this:

{
  "artistId": "dfjksl342f32",
  "artistName": "Radiohead",
  "userName": "johndoe",
  "comment": "Nice band!"
}
{
  "artistId": "fdsklj39fsjl",
  "artistName": "Archive",
  "userName": "walterbates",
  "comment": "It rocks"
}

To do that, you will need to use a WebClient instead of the provided RestTemplate

Containerize the application

Package the application in a docker image and write a docker-compose to run it on Postgres.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤ī¸ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.