[cdi-dev] async activation on observers, why not CompletableFuture

Romain Manni-Bucau rmannibucau at gmail.com
Tue Mar 31 12:00:32 EDT 2015


Hi guys,

on async topic if I followed we are at the point where we are looking for
an activation on the observer side.

Since Java 8 has now CompletableFuture it would be great to use it. Today
the spec doesnt use observer returned values so it is mainly a bad practise
to have one even if not strictly forbidden - BTW never saw it in real
applications - plus spec is not compatible - not specified at all -
with CompletableFuture since it is a new API so we can use it as a marker.

This is quite interesting for few reasons:
1- we have our double activation
2- API is user friendly (observer is async and has an async signature)
3- open door for future async enhancements (hopefully not in CDI) with
composition of these observers


Only point I'm not sure is should these observers support sync events. I
don't see anything blocking to do it but can have missed something.


wdyt?


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/cdi-dev/attachments/20150331/74d3d3ac/attachment.html 


More information about the cdi-dev mailing list