Skip to content

GranitTreff on 22.04.2020 talk Microservices with Thorntail.io

Notifications You must be signed in to change notification settings

Gepardec/GranitTreff-220420

Repository files navigation

Microservices with Thorntail (GranitTreff)

This repository holds the sample application for the talk Microservice with Thorntail at GranitTreff on 22.04.2020. Actually this repository illustrates how a JEE application can run on multiple runtimes such as Quakrus, Thorntail and Wildfly.

Description

This samples application represents an ordinary JEE application with MicroProfiles.

Resources

Maven Poms

Configuration files

Directories

  • ./target
    The plain war.

  • ./target-quarkus
    The Quakrus microservice target directory.

  • ./target-thorntail
    The Thorntail microservice target directory.

  • ./target-wildfly
    The Wildfly microservice target directory.

  • ./src/main/resources
    The resource directory containing resources used by all microservice types.

  • ./src/main/resources-quarkus
    The resource directory containing resources used by Quarkus microservice only.

  • ./src/main/resources-thorntail
    The resource directory containing resources used by Thorntail microservice only.

  • ./src/main/webapp-wildfly
    The web resource directory containing resources used by Wildfly microservice only.

Setup

Setup Maven

Install Maven Wrapper
./mvnw[.cmd] io.takari:maven:wrapper

How to build

Plain WAR
./mvnw[.cmd] clean install -f pom.xml
Thorntail microservice
./mvnw[.cmd] clean install -f pom-thorntail.xml
Quarkus microservice
./mvnw[.cmd] clean install -f pom-quarkus.xml
Wildfly WAR deployment
./mvnw[.cmd] clean install -f pom-wildfly.xml

How to run

Start Thorntail microservice (8081)
./mvnw[.cmd] thorntail:run -f pom-thorntail.xml
java "-Djava.net.preferIPv4Stack=true" "-Dquarkus.http.port=8082" -jar target-thorntail\microprofile-thorntail-0.0.1-SNAPSHOT-thorntail.jar
Start Quarkus microservice (8082)
./mvnw[.cmd] quarkus:dev -f pom-quarkus.xml
java "-Djava.net.preferIPv4Stack=true" "-Dquarkus.http.port=8082" -jar target-quarkus\microprofile-quarkus-0.0.1-SNAPSHOT-runner.jar
Tip
Normally the maven goal quarkus:dev should start the application as well but it fails with ClassNotFoundException (org/jboss/logging/Logger).
I think this is related to working on a Windows OS.
Start/Configure/Deploy Wildfly (8080)
./mvnw[.cmd] wildfly:run -f pom-wildfly.xml

Prepare test

This sample application requires a Jaeger instance running on localhost:6831 where the traces are being send to.

Start Jaeger with docker
docker run -p 6831:6831/udp -p 16686:16686 --name jaeger-local jaegertracing/all-in-one:latest

How to test

If you use Intellij then you can use the test.http file for testing the rest endpoints.
However, see the following available endpoints and use the tool of your choice.

Used ports

The different microservice types run on different ports, so that they can be started concurrently.

  1. Wildfly - 8080

  2. Thorntail - 8081

  3. Quarkus - 8080

With injectable rest client

GET call to external resource

GET 8080|8081|8082/get

POST call to external resource

POST 8080|8081|8082/post

PATCH call to external resource

PATCH 8080|8081|8082/patch

DELETE call to external resource

DELETE 8080|8081|8082/delete

With custom built rest client

GET call to external resource

GET 8080|8081|8082/custom/get

POST call to external resource

POST 8080|8081|8082/custom/post

PATCH call to external resource

PATCH 8080|8081|8082/custom/patch

DELETE call to external resource

DELETE 8080|8081|8082/custom/delete

About

GranitTreff on 22.04.2020 talk Microservices with Thorntail.io

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages