简体   繁体   中英

Externalizing resource adapter configs from standalone.xml in Jboss-as 7.1.1

I'm using Jboss-as 7.1.1

I have configured the resource adapter as below in the standalone.xml file. This basically is the configuration for a outbound queue using Websphere MQ and it works fine.

<subsystem xmlns="urn:jboss:domain:resource-adapters:1.0">
        <resource-adapters>
            <resource-adapter>
                <archive>
                    wmq.jmsra.rar
                </archive>
                <transaction-support>NoTransaction</transaction-support>
                <connection-definitions>
                    <connection-definition class-name="com.ibm.mq.connector.outbound.ManagedConnectionFactoryImpl" jndi-name="java:jboss/jms/MQConnectionFactory" enabled="true" use-java-context="false" pool-name="MqConnectionFactoryPool">
                        <config-property name="port">
                            3434
                        </config-property>
                        <config-property name="hostName">
                            myhost
                        </config-property>
                        <config-property name="channel">
                            CLIENT.TO.AUIHTA01
                        </config-property>
                        <config-property name="transportType">
                            CLIENT
                        </config-property>
                        <config-property name="queueManager">
                            AUIHTA01
                        </config-property>
                    </connection-definition>
                </connection-definitions>
                <admin-objects>
                    <admin-object class-name="com.ibm.mq.connector.outbound.MQQueueProxy" jndi-name="java:jboss/jms/MQOutboundQueue" enabled="true" use-java-context="false" pool-name="MyQueue1Pool">
                        <config-property name="baseQueueManagerName">
                            AUIHTA01
                        </config-property>
                        <config-property name="baseQueueName">
                            XX.CBO.OUT
                        </config-property>
                    </admin-object>
                </admin-objects>
            </resource-adapter>
        </resource-adapters>
    </subsystem>

My requirement is that I need to externalise the configs such as hostName, port etc. This is because I want to change it based on different environments such as development,QA,Live etc. Basically I want to know if these parameters can be externalised to a file so that it can be incuded in my deployment war file or ear file.

You can also use ${env.HOSTNAME} in case you have HOSTNAME set in your environment. Just enable variable replacement in JBoss. (see also https://community.jboss.org/thread/204025 )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM