问题
We would like to deploy an EAR containing message driven beans with JBoss CLI. For each environment there are different activation config property values.
Our question: is it possible to change the values of the activation config properties after deploying the EAR with JBoss CLI?
We know we could use property substitution. However this seems to set the activation properties at server startup. In contrast we would like to change the values at any time (maybe as long as application is disabled).
In 2011 there where a similar question. The answer might be outdated today. It suggests a solution at build time. This is what we have now and what is to be improved.
Background: The MDBS are activated by an IBM Websphere MQ resource adapter. The descriptor ejb-jar.xml
contains snippets like the following one:
<message-driven>
<ejb-name>MyMDB</ejb-name>
<ejb-class>com.acme.MyMDB</ejb-class>
<messaging-type>javax.jms.MessageListener</messaging-type>
<activation-config>
<activation-config-property>
<activation-config-property-name>hostName</activation-config-property-name>
<activation-config-property-value>hostName</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>port</activation-config-property-name>
<activation-config-property-value>1415</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>queueManager</activation-config-property-name>
<activation-config-property-value>queueManagerName</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>channel</activation-config-property-name>
<activation-config-property-value>channelName</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>transportType</activation-config-property-name>
<activation-config-property-value>CLIENT</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>useJNDI</activation-config-property-name>
<activation-config-property-value>true</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>destination</activation-config-property-name>
<activation-config-property-value>java:jboss/queueName</activation-config-property-value>
</activation-config-property>
</activation-config>
</message-driven>
回答1:
The aspect domain will not be helpful for you. This was available in earlier versions of JBoss. The second link to article 180233 essentially says that AOP is not longer supported in the current JBoss releases.
MDB activation specs are set at deployment time for the MDB jar. You can use property substitution as noted to configure your MDB. You can change the system properties on the fly:
/system-property=wmq.port:remove
/system-property=wmq.port:add(value=1515)
/system-property=wmq.port:read-resource
If you then re-deploy your MDB jar, the new property value would be substituted.
回答2:
One possible solution could be to "try to convert your MDBs into AspectDomain", an idea of which you could get from the link below:
https://developer.jboss.org/thread/178162
More details should be available here:
How to set MDB ActivationConfigProperty at runtime using JBoss AOP in JBoss EAP 6
https://access.redhat.com/solutions/180233
来源:https://stackoverflow.com/questions/42212788/change-activation-config-property-on-deployment-via-jboss-cli