All Projects → infinispan-demos → harry-potter-quarkus

infinispan-demos / harry-potter-quarkus

Licence: Apache-2.0 license
Showcases in a web application Quarkus and Infinispan

Programming Languages

java
68154 projects - #9 most used programming language
HTML
75241 projects
shell
77523 projects

Projects that are alternatives of or similar to harry-potter-quarkus

quarkus-performance
Comparing the CPU/Memory utilisation - Quarkus via GraalVM Native Image vs. Quarkus via Java Runtime vs. Payara-Micro via Java Runtime.
Stars: ✭ 49 (+206.25%)
Mutual labels:  graalvm, graal-native, quarkus
clojure-rust-graalvm
An example of Clojure program calling a Rust library, all combined into one executable using GraalVM.
Stars: ✭ 113 (+606.25%)
Mutual labels:  graalvm, graal-native
azure-native-spring-function
Tutorial on running Spring Boot + GraalVM native images on Azure Functions
Stars: ✭ 56 (+250%)
Mutual labels:  graalvm, graal-native
native-java-examples
Native Java Apps with Micronaut, Quarkus, and Spring Boot
Stars: ✭ 44 (+175%)
Mutual labels:  graalvm, quarkus
native-build-tools
Native-image plugins for various build tools
Stars: ✭ 168 (+950%)
Mutual labels:  graalvm
quarkus-resteasy-problem
Unified error responses for Quarkus REST APIs via Problem Details for HTTP APIs (RFC7807). Supports Quarkus 2.0+ and 1.4+
Stars: ✭ 36 (+125%)
Mutual labels:  quarkus
openshift-quickstart
Developer Workshops related to the Java development on OpenShift
Stars: ✭ 19 (+18.75%)
Mutual labels:  quarkus
docker-graalvm
A base image to run apps using https://www.graalvm.org
Stars: ✭ 11 (-31.25%)
Mutual labels:  graalvm
base-starter-flow-quarkus
A project base/example for using Vaadin with Quarkus
Stars: ✭ 23 (+43.75%)
Mutual labels:  quarkus
quarkiverse
Repository for contributing to quarkiverse wiki
Stars: ✭ 29 (+81.25%)
Mutual labels:  quarkus
dad
Small configuration management tool for Clojure
Stars: ✭ 122 (+662.5%)
Mutual labels:  graalvm
scala-graalvm-lambda
Sample application of Native Scala with GraalVM.
Stars: ✭ 15 (-6.25%)
Mutual labels:  graalvm
connor
A commandline tool for resetting Kafka Connect source connector offsets.
Stars: ✭ 17 (+6.25%)
Mutual labels:  graalvm
tools-deps-native
Run tools-deps-alpha as a native binary.
Stars: ✭ 30 (+87.5%)
Mutual labels:  graalvm
netty-native-demo
Instant Netty startup using GraalVM's Native Image Generation
Stars: ✭ 58 (+262.5%)
Mutual labels:  graalvm
mysql-mle-demos
Demos for the MySQL Multi-Lingual Environment
Stars: ✭ 16 (+0%)
Mutual labels:  graalvm
springboot-keycloak-openldap
The goal of this project is to create a simple Spring Boot REST API, called simple-service, and secure it with Keycloak. Furthermore, the API users will be loaded into Keycloak from OpenLDAP server.
Stars: ✭ 96 (+500%)
Mutual labels:  graalvm
graphql-example
A MicroProfile GraphQL Example
Stars: ✭ 44 (+175%)
Mutual labels:  quarkus
vertx-graalvm-native-image-test
GraalVM - Substrate VM - Test project for Vert.x
Stars: ✭ 38 (+137.5%)
Mutual labels:  graalvm
popular-movie-store
A very basic shopping cart application to show Stateful Canary Deployments on Kubernetes using Spring Boot and Infinispan
Stars: ✭ 22 (+37.5%)
Mutual labels:  infinispan

Harry Potter Quarkus Demo

The main goal of this demo is to showcase how to use Infinispan client with Quarkus.

Infinispan features that are being used:

  • Create stores dynamically

  • Simple get/put operations

  • Full-text query

  • Continuous query

Quarkus features:

  • REST web-service

  • Web Socket

  • Task Scheduling

  • Application properties

  • Application lifecycle events listeners

The demo is composed by two applications that run independently:

  • Hogwarts monitoring

  • Wizards magic

Each application has a dedicated section in this documentation

Before running the demo

Quarkus uses the Infinispan Remote Client ("Hot Rod"). You need to have an Infinispan Server running before you run this demo.

Option 1: Use Docker

docker run -it -p 11222:11222 -e USER="admin" -e PASS="password" infinispan/server
Important
Docker for mac users. There is a known issue to connect with the server using the Hot Rod client. Blog post here. You won’t need to do this in production, but for testing/development purposes, if you want to connect to a Infinispan Server running in a Docker container, create hotrod-client.properties file under src/main/resources/META-INF folder in each application and configure infinispan.client.hotrod.client_intelligence=BASIC

Option 2: Download and run the server

  • Download the server from here

  • Unzip the file

  • Create a user with admin rights from the installation folder: ./bin/cli.sh user create admin -p password

  • Run a standalone server from the installation folder: ./bin/server.sh

Hogwarts Monitoring

Characters can execute spells, and we want to monitor who is in Hogwarts and performing magic.

  • A Character has an id, name, biography and type (other, student, teacher, muggle).

  • A Spell has an id, name and description.

  • A Spell is performed by a character. This character may or may not be at Hogwarts.

Data loading

DataLoader class loads characters and spells in two separate stores. This is done at startup time

Magic is going on

Hogwarts Magic Creator is going to emulate characters performing some magic. It will randomly pick a character and a spell to perform (if they can)! Characters in Hogwarts are teachers or students.

Tip
To disable this service, set create.magic property to false in the application.properties.

A simple REST service is available to query characters by id or perform a full-text search of the name or the biography.

Magic Socket

A socket that performs a Continuous Query making it possible to monitor which characters in Hogwarts are currently performing magic. The continuous query does not have to go to the server and it is all stored in the client application itself. Read more about these queries in the official Infinispan documentation.

Hogwarts Monitoring WebSocket

Run Hogwarts Monitoring in dev mode

Change into the hogwarts-monitoring directory. To run in development mode, just run mvn clean compile quarkus:dev. This allows for hot swapping the application, so you can tweak parts of it and it will automatically redeploy.

Go to http://localhost:8080 and monitor the magic!

You will be connected to the monitoring socket. The interface displays some links to display a character by id and perform a full-text search.

Build and run the demo with jar
mvn clean package
cd target
java -jar hogwarts-monitoring-runner.jar
Build and run the application in native mode
mvn package -Pnative
cd target
./hogwarts-monitoring-runner

Loaded data

Maven copies hp_characters.csv and hp_spells.csv to the target directory, that’s why it’s easier to run the executables from the target folder. However you can override these files location at runtime.

Running the jar
java -jar  -Dcharacters.filename=/my/path/hp_characters.csv -Dspells.filename=/my/path/hp_spells.csv hogwarts-monitoring-runner.jar
Running the native
./hogwarts-monitoring-runner -Dcharacters.filename=/my/path/hp_characters.csv -Dspells.filename=/my/path/hp_spells.csv

Wizards Magic

The wizards-magic application is a simple web application that allows to put curses on someone!

Run this application as explained above. The application will be available at http://localhost:8082.

A simple form will be displayed. You can add you name, pick a curse and tell which kind of Wizard you are. If the Hogwarts monitoring is running, you should be able to see your curse displayed…​ If you chose to be a teacher or a student, of course!

Kubernetes

Install and start Minikube

 minikube start --driver=virtualbox --cpus 4 --memory "8192mb"

Create Kubernetes Secret clients-credentials

kubectl create secret generic clients-credentials
--from-literal=infinispan-username=admin
--from-literal=infinispan-password=secret

Build and deploy

eval $(minikube -p minikube docker-env)
./mvnw clean package -Dquarkus.kubernetes.deploy=true -DskipTests=true

Install the Infinispan Operator

curl -sL https://github.com/operator-framework/operator-lifecycle-manager/releases/download/v0.19.1/install.sh | bash -s v0.19.1
kubectl create -f https://operatorhub.io/install/infinispan.yaml
kubectl get csv -n operators

Create Infinispan identities secret

kubectl create secret generic --from-file=identities.yaml connect-secret

Deploy infinispan server

kubectl apply -f infinispan.yaml
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].