https://github.com/abhirockzz/cdi-async-events
Asynchronous events in CDI 2.0
https://github.com/abhirockzz/cdi-async-events
asynchronous cdi concurrency docker executor-service glassfish5 javaee8 jsr server-sent-events
Last synced: 2 months ago
JSON representation
Asynchronous events in CDI 2.0
- Host: GitHub
- URL: https://github.com/abhirockzz/cdi-async-events
- Owner: abhirockzz
- Created: 2017-06-10T18:27:19.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-06-16T12:00:51.000Z (almost 8 years ago)
- Last Synced: 2025-01-04T03:22:01.333Z (4 months ago)
- Topics: asynchronous, cdi, concurrency, docker, executor-service, glassfish5, javaee8, jsr, server-sent-events
- Language: Java
- Homepage: https://abhirockzz.wordpress.com/2017/06/11/cdi-2-0-async-events/
- Size: 9.77 KB
- Stars: 3
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## To run....
- `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 run --rm --name gf5cdi -it -p 8080:8080 -p 4848:4848 -p 8181:8181 abhirockzz/gf5-nightly-cdi-example`
- what's the Docker host IP ? `docker-machine ip` (e.g. 192.168.99.100)## Test it...
- `http://:8080/cdi-async-events/events/subscribe`. You should see a continuous stream of (SSE) events

- Pick a [Websocket client](https://chrome.google.com/webstore/detail/simple-websocket-client/pfdhoblngboilpfeibdedpjgfnlcodoo?hl=en) and use it connect to the Websocket endpoint `ws://:8080/cdi-async-events/`. You will see the same event stream...

*Try this with multiple clients - for both SSE and Websocket*. Console logs show the asynchronous nature of CDI events
Notice the asynchronous events running in Managed Executor service thread

You can choose to let things run in the default (container) chosen thread

## once you're done
`docker stop gf5cdi`