[cdi-dev] JMS 2.1: Proposal to allow any CDI managed bean in a Java EE application to listen for JMS messages

arjan tijms arjan.tijms at gmail.com
Tue Aug 25 16:53:21 EDT 2015


Hi,

On Tue, Aug 25, 2015 at 7:07 PM, Nigel Deakin <nigel.deakin at oracle.com> wrote:
> On 25/08/2015 12:38, arjan tijms wrote:
> This looks very interesting. Does this work with any normal scope?

Yes, all normal scopes that are available in standard Java EE support
this as far as I know.

There's the small caveat that CDI itself doesn't know about this
automatically for any custom normal scope. That implementation of such
scope (via a Context) must explicitly throw these events.

For example, this is what Mojarra does for the @FlowScoped implementation:

https://github.com/omnifaces/mojarra/blob/master/jsf-ri/src/main/java/com/sun/faces/flow/FlowCDIEventFireHelperImpl.java

Which is fired when the scope starts here:
https://github.com/omnifaces/mojarra/blob/master/jsf-ri/src/main/java/com/sun/faces/flow/FlowCDIContext.java#L431

(the exact same code is used for @ViewScoped in Mojarra as well)


> then every time a new request starts, this event is fired which causes an
> instance of the bean to be created for that request?

Yes, that is what this does ;)

Kind regards,
Arjan Tijms


More information about the cdi-dev mailing list