Description
Migrated from microprofile/microprofile-reactive-streams-operators#30
Comment by @smillidge:
Some of the annotations being produced are similar to CDI Events. Could this be used to enhance the CDI Observer model. For example Payara Micro does asynch eventing across process boundaries by adding the @Inbound
and @Outbound
annotations to the standard CDI apis. See https://docs.payara.fish/documentation/payara-server/public-api/cdi-events.html
Comment by @jroper:
I think it can, and @cescoffier and I were going to schedule some meetings with some of the CDI committers to discuss further.
One issue that we think exists at the moment is that listeners are unable to asynchronously propagate backpressure. Backpressure can be asynchronously propagated by event publishers using fireAsync
and attaching to the returned CompletionStage
. However, event listeners don't seem to have any such mechanism. One way they could provide some mechanism is by allowing them to return CompletionStage<Void>
, and ensuring the publisher that invoked fireAsync
doesn't have its CompletionStage
redeemed until the listener redeems the CompletionStage
it returns.
Other than that, we think a good way to offer integration with CDI events would be to allow them to be a messaging provider.
Comment by @hutchig:
The Payara @Inbound
and @Outbound
annotions have come up in some of the discussions in the hangout. CDI integration is very interesting along with an idea like
https://simonbasle.github.io/2018/02/contextual-logging-with-reactor-context-and-mdc/
http://projectreactor.io/docs/core/release/reference/#context
Comment by @jroper:
This may need to wait until 1.1 till we get the backpressure on handling events support into CDI.
Also, another option to consider - perhaps integration with CDI events could be the mechanism through which we implement #26, context detached streams, since that already supports injecting for example the CDI Event firer. Reactive Streams support in CDI itself might be needed to do it well.