项目作者: abhirockzz

项目描述 :
Asynchronous events in CDI 2.0
高级语言: Java
项目地址: git://github.com/abhirockzz/cdi-async-events.git
创建时间: 2017-06-10T18:27:19Z
项目社区:https://github.com/abhirockzz/cdi-async-events

开源协议:

下载


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://<docker_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://<docker_ip>: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