It's time to take Java EE 8 for a spin and try out Glassfish 5 builds on Docker using Oracle Container Cloud. Java EE specifications covered
Here is a quick summary of what's going on
Notice the asynchronous events running in Managed Executor service thread
You can choose to let things run in the default (container) chosen thread
Please note that I have used my personal Docker Hub account (abhirockzz) as the registry. Feel free to use any Docker registry of your choice
git clone https://github.com/abhirockzz/cdi-async-events.git
mvn clean install
docker build -t abhirockzz/gf5-nightly -f Dockerfile_gf5_nightly .
docker build -t abhirockzz/gf5-cdi-example -f Dockerfile_app .
docker push abhirockzz/gf5-cdi-example
You see this once the container (and the application) start..
Drill down into the (Docker) container and check the IP for the host where it's running and note it down
Make use of the Host IP you just noted down
http://<occs_host_ip>:8080/cdi-async-events/events/subscribe - You should see a continuous stream of (SSE) events
Pick a Websocket client and use it connect to the Websocket endpoint ws://<occs_host_ip>:8080/cdi-async-events/
You will see the same event stream... this time, delivered by a Websocket endpoint
You can try this with multiple clients - for both SSE and Websocket
Enjoy Java EE 8 and Glassfish !
**The views expressed in this post are my own and do not necessarily reflect the views of Oracle