Can we use environment values in jboss.xml

69 Views Asked by At

i am using JBOSS EAP5

can we use a linux level environment variable like $env_var (below) for activation-config-property-value inside jboss.xml ?? I tried searching documentation didnt find examples. Looking forward for example / synatx for same.

<message-driven>
    <ejb-name>ExampleMDB</ejb-name>
    <ejb-class>org.jboss.tutorial.mdb_deployment_descriptor.bean.ExampleMDB</ejb-class>
     <transaction-type>Bean</transaction-type>
     <message-destination-type>javax.jms.Queue</message-destination-type>
   <activation-config>
      <activation-config-property>
        <activation-config-property-name>acknowledgeMode</activation-config-property-name>
        <activation-config-property-value>$env_var</activation-config-property-value>
      </activation-config-property>
    </activation-config>
</message-driven>
1

There are 1 best solutions below

0
DuncG On

When I used JBoss (some time ago now so don't know if it is handled directly these days), I would generate the deployment jboss xml config files during a build to get the specific XML needed for every server dev/qa/prod permutation in the release process.

Something like Velocity template engine could be take your general version and expand variables from predefined config or to be run for each of your user account to make one tailored specific to each JBoss server deployment. https://velocity.apache.org/

You could also write simple bash to run as your user which writes the current env values into JBoss config. Not high tech but it works, especially if you have one or few deployments.

$ export MSG="HELLO WORLD"
$ cat << EOF > jboss.xml
<somexml>$MSG</somexml>
EOF

$ cat jboss.xml
<somexml>HELLO WORLD</somexml>