users@jms-spec.java.net

[jms-spec users] Re: JMS_SPEC-134: Declarative Annotation Based JMS Listeners

From: Nigel Deakin <nigel.deakin_at_oracle.com>
Date: Mon, 24 Aug 2015 17:37:48 +0100

On 24/08/2015 16:29, Evans Armitage wrote:
> Hi Nigel,
>
>
> For ".. if the injected bean is a JMS listener, and the listener has "normal" scope. then the developer needs to be
> aware that they need to call a method to force it to start listening. "
>
> Would it not be cleaner to have an @Eager annotation similar to
>
> https://github.com/omnifaces/omnifaces/blob/2.1/src/main/java/org/omnifaces/cdi/eager/EagerExtension.java
>

Hmm. Yes it would.

In fact I wonder whether we should try and make this the default behaviour for any normal-scoped bean which is annotated
with @JMSListener (assuming that this is possible to implement in a portable extension). Creating an instance lazily
when a business method is invoked doesn't really make sense when the bean is a listener.

Nigel