Glassfish 5 builds for Java EE 8 are rolling along… here is another Docker based example on Github. This time it’s asynchronous events in CDI 2.0 (JSR 365)
Steps
Just follow the README… just a bunch of docker
commands to get started..!
What’s going on
Here is a quick summary
- A Java EE scheduler triggers asynchronous CDI events (
fireAsync()
)- These CDI events are qualified (using a custom
Qualifier
) - It also uses a custom
java.util.concurrent.Executor
(based on the Java EE Concurrency UtilityManagedExecutorService
) – thanks to theNotificationOptions
supported by the CDI API
- These CDI events are qualified (using a custom
- Two (async) CDI observers (
@ObservesAsync
) – a JAX-RSSSE
broadcaster and aWebsocket
endpoint SSE
&Websocket
endpoints cater to their respective clients – details on how to connect in the README
Notice the asynchronous events running in Managed Executor service thread
You can choose to let things run in the default (container) chosen thread
Further reading
Cheers!