<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">

<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>

                                <td>

                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="https://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>

                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px;  -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
    Websphere MQ integration with MDB on AS7/EAP6 reloaded
</h3>
<span style="margin-bottom: 10px;">
    created by <a href="https://community.jboss.org/people/akrambenaissi">Akram Ben Aissi</a> in <i>EJB3</i> - <a href="https://community.jboss.org/message/737377#737377">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">

<div class="jive-rendered-content"><p>Hello all,</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>A similar subject has been discussed at most in 2 other threads a few months ago, and since I am working on a similar subject I would like to try to make the situation the clearer possible to incitate my customer to raise tickets on the relevant vendors.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>So the subject is the integration of Webpshere MQ with MessageDrivenBean on JBoss AS7 / EAP6 (Beta2).</p><p>Here is the code:</p><p><span style="color: #646464; font-size: 10pt;">&#160; </span></p><pre class="jive-pre"><code class="jive-code jive-java">@MessageDriven(name = <font color="red">"WebsphereMQMessageDrivenBean"</font>, mappedName = <font color="red">"mdb/WebsphereMQMessageDrivenBean"</font>, activationConfig = <font color="navy">{</font>
&#160;&#160;&#160; @ActivationConfigProperty(propertyName = <font color="red">"destinationType"</font>, propertyValue = <font color="red">"javax.jms.Queue"</font>),
&#160;&#160;&#160; @ActivationConfigProperty(propertyName = <font color="red">"messagingType"</font>, propertyValue = <font color="red">"javax.jms.MessageListener"</font>),
&#160;&#160;&#160; @ActivationConfigProperty(propertyName = <font color="red">"destination"</font>, propertyValue = <font color="red">"TEST_QUEUE"</font>),
&#160;&#160;&#160; @ActivationConfigProperty(propertyName = <font color="red">"queueManager"</font>, propertyValue = <font color="red">"TEST_QUEUE_MANAGER"</font>),
&#160;&#160;&#160; @ActivationConfigProperty(propertyName = <font color="red">"hostName"</font>, propertyValue = <font color="red">"localhost"</font>),
&#160;&#160;&#160; @ActivationConfigProperty(propertyName = <font color="red">"port"</font>, propertyValue = <font color="red">"1416"</font>),
&#160;&#160;&#160; @ActivationConfigProperty(propertyName = <font color="red">"channel"</font>, propertyValue = <font color="red">"JBOSS.SVRCONN"</font>) <font color="navy">}</font>)
@ResourceAdapter(<font color="red">"wmq.jmsra.rar"</font>)
@TransactionManagement(CONTAINER)
@Named
<font color="navy"><b>public</b></font> <font color="navy"><b>class</b></font> WebsphereMQMessageDrivenBean <font color="navy"><b>implements</b></font> MessageListener <font color="navy">{</font>
</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Clearly, the issue is that nobody can't live with the configuration hardcoded. And even if setting this configuration in jboss-ejb3.xml (which also works perfectly), that leads to change the JAR/EAR/WAR before putting in production, which is quite dangerous.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>It seems that, in the past several workarounds used to exist (AOP or using placeholders in deployment desciptors) that would not work anymore with AS7. Anyway, these were workarounds, and a real solution is always better.</p><p>As a conclusion of another thread, it seems that this is specific to the used resource adapter, which I really want to be sure.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>To do so, here are two tracks that I would like to explore:</p><p>Is there a way to set the jndi name of the "destination" of an MDB ? Other vendors seem to use a property <code>destination-jndi-name in customer descriptor to set it. Moreover, MQ also has a parameter useJNDI (default false) to change how the "destination" parameter must be interpreted. And this does not seem to have effect. According to their doc, if useJNDI is set to true, the "destination" parameter is treated as the JNDI name of the destination queue. How can we be sure that the JNDI lookup is properly performed (with the correct InitialContext)? This does not seem to be the case, because MQ still tries to use "hostName" and the other configuration parameters, which are set in the AS configuration.</code></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>The other track is changing the default Resource Adapter for JMS: This is documented in EAP6 official doc, and it works: One can change from hornetq-ra to wmq.jmsra.rar which turns mq to the default JMS provider for MDB. And this allows to get rid of the @ResoruceAdapter annotation. But, even if a resource adapter wmq.jmsra.rar is declared and properly default configured, the JMS provider arrives unconfigured to the MDB and needs ActivationConfigProperty to work.</p><p>Is this the expected behaviour? If yes, that would be nice if the wmq.jmsra.rar could be treated as reference accompagned with its configuration instead of the name or the rar to load.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I am not sure a solution that would make everybody (or at least me) happy exists, so please treat this discussion as a feature request.</p></div>

<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
    <p style="margin: 0;">Reply to this message by <a href="https://community.jboss.org/message/737377#737377">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in EJB3 at <a href="https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2029">Community</a></p>
</div></td>
                        </tr>
                    </tbody>
                </table>


                </td>
            </tr>
        </tbody>
    </table>

</div>

</body>
</html>