<div dir="ltr">Nigel, what do you mean by : <div><br></div><div>&quot;The application must obtain an instance of the JMS listener bean using dependency injection&quot;</div><div><br></div><div>In your examples, it looks like a CDI bean cannot start listening if not injected : </div><div><br></div><div><div><font face="monospace, monospace">@WebServlet(&quot;/myjmsservlet1&quot;)</font></div><div><font face="monospace, monospace"> public class MyJMSServlet1 extends HttpServlet {</font></div><div><font face="monospace, monospace"> </font></div><div><font face="monospace, monospace">   <b>@Inject MyDepScopeListenerBean</b> myDepScopeListenerBean;</font></div><div><font face="monospace, monospace">    </font></div><div><font face="monospace, monospace">   public void service(ServletRequest req, ServletResponse res) throws IOException, ServletException {</font></div><div><font face="monospace, monospace">      ...</font></div><div><font face="monospace, monospace">   }</font></div><div><font face="monospace, monospace"> }</font></div></div><div><br></div><div><br></div><div>Did I understand well ? Is this the case ? Just like a MDB, I would like a CDI bean to start listening to a message without being injected, as soon as the application starts. Something like :  </div><div><br></div><div><div><font face="monospace, monospace"><b>@ApplicationScoped</b></font></div><div><font face="monospace, monospace">public class MyListenerBean{</font></div><div><font face="monospace, monospace"> </font></div><div><font face="monospace, monospace">   @JMSListener(lookup=&quot;java:global/java:global/Trades&quot;,type=JMSListener.Type.TOPIC )</font></div><div><font face="monospace, monospace">   public void deliver(Message message) {</font></div><div><font face="monospace, monospace">     ...</font></div><div><font face="monospace, monospace">   }</font></div><div><font face="monospace, monospace">}</font></div></div><div><br></div><div>Or if we manage to get the <font face="monospace, monospace">@Startup</font> annotation to Commons Annotation : </div><div><br></div><div><div><div><font face="monospace, monospace"><b>@Startup</b></font></div><div><font face="monospace, monospace">public class MyListenerBean{</font></div><div><font face="monospace, monospace"> </font></div><div><font face="monospace, monospace">   @JMSListener(lookup=&quot;java:global/java:global/Trades&quot;,type=JMSListener.Type.TOPIC )</font></div><div><font face="monospace, monospace">   public void deliver(Message message) {</font></div><div><font face="monospace, monospace">     ...</font></div><div><font face="monospace, monospace">   }</font></div><div><font face="monospace, monospace">}</font></div></div></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace"><br></font></div><div><font face="arial, helvetica, sans-serif">Just thinking here</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">Antonio</font></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Aug 24, 2015 at 6:30 PM, Nigel Deakin <span dir="ltr">&lt;<a href="mailto:nigel.deakin@oracle.com" target="_blank">nigel.deakin@oracle.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Over in the JMS 2.1 expert group I&#39;ve just published some proposals to allow any CDI managed bean in a Java EE<br>
application to listen for JMS messages. This would be implemented as a standard CDI portable extension and would become<br>
a mandatory part of a full Java EE 8 application server.<br>
<br>
I would welcome any comments from the CDI spec experts here. If you&#39;re interested in helping, please take a look at<br>
<a href="https://java.net/projects/jms-spec/pages/CDIBeansAsJMSListeners" rel="noreferrer" target="_blank">https://java.net/projects/jms-spec/pages/CDIBeansAsJMSListeners</a><br>
and send comments or questions to me or to the public <a href="mailto:users@jms-spec.java.net">users@jms-spec.java.net</a> alias.<br>
<br>
Thanks,<br>
<br>
Nigel<br>
JMS 2.1 specification lead<br>
_______________________________________________<br>
cdi-dev mailing list<br>
<a href="mailto:cdi-dev@lists.jboss.org">cdi-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/cdi-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/cdi-dev</a><br>
<br>
Note that for all code provided on this list, the provider licenses the code under the Apache License, Version 2 (<a href="http://www.apache.org/licenses/LICENSE-2.0.html" rel="noreferrer" target="_blank">http://www.apache.org/licenses/LICENSE-2.0.html</a>). For all other ideas provided on this list, the provider waives all patent and other intellectual property rights inherent in such information.<br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr">Antonio Goncalves <br>Software architect, Java Champion and Pluralsight author<br><br><a href="http://www.antoniogoncalves.org" target="_blank">Web site</a> | <a href="http://twitter.com/agoncal" target="_blank">Twitter</a> | <a href="http://www.linkedin.com/in/agoncal" target="_blank">LinkedIn</a> | <a href="http://pluralsight.com/training/Authors/Details/antonio-goncalves" target="_blank">Pluralsight</a> | <a href="http://www.parisjug.org" target="_blank">Paris JUG</a> | <a href="http://www.devoxx.fr" target="_blank">Devoxx France</a></div></div>
</div>