Hello all,
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.
So the subject is the integration of Webpshere MQ with MessageDrivenBean on JBoss AS7 / EAP6 (Beta2).
Here is the code:
@MessageDriven(name = "WebsphereMQMessageDrivenBean", mappedName = "mdb/WebsphereMQMessageDrivenBean", activationConfig = {
@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
@ActivationConfigProperty(propertyName = "messagingType", propertyValue = "javax.jms.MessageListener"),
@ActivationConfigProperty(propertyName = "destination", propertyValue = "TEST_QUEUE"),
@ActivationConfigProperty(propertyName = "queueManager", propertyValue = "TEST_QUEUE_MANAGER"),
@ActivationConfigProperty(propertyName = "hostName", propertyValue = "localhost"),
@ActivationConfigProperty(propertyName = "port", propertyValue = "1416"),
@ActivationConfigProperty(propertyName = "channel", propertyValue = "JBOSS.SVRCONN") })
@ResourceAdapter("wmq.jmsra.rar")
@TransactionManagement(CONTAINER)
@Named
public class WebsphereMQMessageDrivenBean implements MessageListener {
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.
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.
As a conclusion of another thread, it seems that this is specific to the used resource adapter, which I really want to be sure.
To do so, here are two tracks that I would like to explore:
Is there a way to set the jndi name of the "destination" of an MDB ? Other vendors seem to use a property 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.
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.
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.
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.