Skip to content

jesperancinha/sea-shell-archiver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sea-shell-archiver


Generic badge GitHub release GitHub contributors

CircleCI Build status sea-shell-archiver S_ARCH e2e-sea-shell-archiver

Codacy Badge codebeat badge Known Vulnerabilities

Codacy Badge Coverage Status codecov

GitHub language count GitHub top language GitHub top language


Description

This project is a Sea Shell archiver for an imaginary world.

This is the description of that world:

Imagine a world were beings live in gigantic sea shells. Sea shells are their home. Inside you can find one or more people. You can also find one or more costumes with different configuration. The value of the shell is evaluated by the sum of the values of all the individual costumes. Every shell has a slogan.

For the purposes of this example I decided to use Cardi B's rap solo in "Girls like you" by Maroon 5 to establish slogans. As persons living inside shells I chose Game of Thrones charachters. For the rest, just my vivid imagination :).

This application is very old. Its design still is base on the paradigms of the time. It's implemented in SOAP. Furthermore, every single entity has a dedicated read service associated with it. As a result, every time you need to get the data from a particular sea shell, you have to make multiple requests. This situation warrants a solution. Times have changed and applications need to move faster and be scalable, but due to business restrictions I cannot change my SOAP services. A solution could be using Reactive Streams in the context of a Reactive architecture.

This is what this application is about.

Essentially this is a fun exercise to help understand some of the mechanisms behind the concepts described in the Reactive Manifesto.

Topics discussed:

Stable Releases

Stable releases

How to Guide

Revision dates: 2020/01/29,

To start interacting with it, you need to start runnable modules:

  1. sea-shell-soap-service - SeaShellWiremockSoapLauncher - Soap mock service (The blocking source) - Runs on port 8090 - (DEPRECATED) - There will be a major mock update on a coming version sometime.
  2. sea-shell-rest-service - SeaShellApplication - WireMock Rest Service data provider (Uses the SOAP blocking, legacy, outdated SOAP service) - Runs on port 8080
  3. sea-shell-client - Three executables to be used in running against sea-shell-rest-service using futures and fork joins. Be sure to run the REST service and the WireMock SOAP service
  4. sea-shell-sea-shell-service-immutable - Standalone compact service running in an immutable fashion using Java records - Runs on port 8081

In order to run the full example, please create your local bin folder

make build local

This will create the bin folder. The jars are self-explanatory. To run each one of them please use the corresponding command in different terminal windows:

java -jar sea-shell-soap-service.jar
java -jar sea-shell-rest-service.jar
java -jar sea-shell-service-immutable.jar

You can, alternatively, with your docker machine/desktop running, run a docker container:

docker-compose up

To terminate your tests, you can just run

docker-compose down

Java version

sdk install java 19-open
sdk use java $(sdk list java | grep installed | grep "| 19" |  cut -d'|' -f6- | cut -d' ' -f2-)

Testing endpoints

Blocking and Almost Reactive Methods

  1. http://localhost:8080/seashells
  2. http://localhost:8080/seashells/1
  3. http://localhost:8080/seashells/slogans
  4. http://localhost:8080/seashells/block
  5. http://localhost:8080/seashells/block/1
  6. http://localhost:8080/seashells/reactiveblock
  7. http://localhost:8080/seashells/reactiveWithDelay
  8. http://localhost:8080/seashells/reactiveWithForkJoins

Reactive endpoints

  1. http://localhost:8080/seashells/reactive/1
  2. http://localhost:8080/seashells/reactive/rootCostume/1/1
  3. http://localhost:8080/seashells/reactive/rootShell/1/1
  4. http://localhost:8080/seashells/reactive/rootCostumeSlowTop/1/1
  5. http://localhost:8080/seashells/reactive/rootCostumeSlowLower/1/1

Reactive One endpoints

  1. http://localhost:8080/seashells/one
  2. http://localhost:8080/seashells/one/1
  3. http://localhost:8080/seashells/one/person/1
  4. http://localhost:8080/seashells/one/costume/1
  5. http://localhost:8080/seashells/one/account/1
  6. http://localhost:8080/seashells/one/top/1
  7. http://localhost:8080/seashells/one/lower/1

Immutable Reactive endpoints (the real deal!)

  1. http://localhost:8081/seashells/immutable
  2. http://localhost:8081/seashells/immutable/1
  3. http://localhost:8081/seashells/immutable/person/1
  4. http://localhost:8081/seashells/immutable/costume/1
  5. http://localhost:8081/seashells/immutable/account/1
  6. http://localhost:8081/seashells/immutable/top/1
  7. http://localhost:8081/seashells/immutable/lower/1

References

Please check the docs for more info.

Technical

Domain knowledge

Legacy

Hints and Tricks

Please check my documentation on Hints&Tricks for more details

If for any reason, the import of this project fails or the upgrade fails, please close your IDE. Via a shell run the following command:

git clean -xdf

This will remove all non-versioned files from your repo. It will allow your IDE to re-import fresh from start. Make sure that the caches are invalidated and removed in this case.

About me

GitHub followers