How to access propeties from module in ejb-jar.xml

Posted on

We are using MDB and Message Listener and in ejb-jar.xml we have to set MDB related properties using property file in the ejb-jar.xml file. These property files are defined in the JBOSS module.
Could you please let me know how to access these properties in the ejb-jar.xml using JBOSS module.

As a temporary solution, we have added system properties in the standalone-full.xml and we are using these system properties in the ejb-jar.xml file, however we have to read these properties from the property file using JBOSS module.

Working code sample

ejb-jar.xml
<message-driven>
  <!-- Message Listener setting for queue -->
    <ejb-name>PSInboundMessageListener</ejb-name>
            <ejb-class>com.xx.MessageListener</ejb-class>
            <transaction-type>Container</transaction-type>
            <activation-config>
                <activation-config-property>
                    <activation-config-property-name>destination</activation-config-property-name>
                    <activation-config-property-value>${jndi.queue}</activation-config-property-value>
                </activation-config-property>
                <activation-config-property>
                    <activation-config-property-name>destinationType</activation-config-property-name>
                    <activation-config-property-value>${destinationtype}</activation-config-property-value>
                </activation-config-property>
                <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>${mqconnection.port}</activation-config-property-value>
                </activation-config-property>
                <activation-config-property>
                    <activation-config-property-name>queueManager</activation-config-property-name>
                    <activation-config-property-value>${queuemanager}</activation-config-property-value>
                </activation-config-property>
                <activation-config-property>
                    <activation-config-property-name>sslCipherSuite</activation-config-property-name>
                    <activation-config-property-value>${sslCipherSuite}</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>channel</activation-config-property-name>
                    <activation-config-property-value>${channel}</activation-config-property-value>
                </activation-config-property>
            </activation-config>

             <env-entry>
                <env-entry-name>ejb/BeanFactoryPath</env-entry-name>
                <env-entry-type>java.lang.String</env-entry-type>
                <env-entry-value>applicationContext_File.xml</env-entry-value>
            </env-entry> 
    </message-driven>

Standalone-full.xml

  <system-properties>
        <property name="javax.net.ssl.trustStore" value="<LOCAL_PATH>/keystore/truststore.jks"/>
        <property name="javax.net.ssl.trustStorePassword" value="pwd"/>
        <property name="javax.net.ssl.keyStore" value="<LOCAL_PATH>/keystore.jks"/>
        <property name="javax.net.ssl.keyStorePassword" value="pwd"/>
        <property name="queue" value="java:/queue"/>
         <property name="fx.cls.error.queue" value="error_queue"/>
        <property name="connection.factory" value="ConnectionFactory"/> 
    <property name="destinationtype" value="javax.jms.Queue"/>
        <property name="hostname" value="hostname"/>
        <property name="port" value="64402"/>
        <property name="queuemanager" value="QueueManager"/>
        <property name="sslCipherSuite" value="sslCipherSuite"/>
        <property name="channel" value="channel"/>
    </system-properties>

Expected 

<jboss-deployment-structure>
        <deployment>
            <dependencies>
                <module name="referencedata.xx.properties" />
            </dependencies>
        </deployment>
</jboss-deployment-structure>  


code from module.xml

<module xmlns="urn:jboss:module:1.1" name="referencedata.xx.properties"> 
    <resources> 
        <resource-root path="."/> 
<!-- It contains property files -->
    </resources> 
</module>

How to access properties defined in referencedata.xx.properties module in ejb-jar.xml for MDB configuration? or Is there any other way to access it to configure MDB?

Appreciate your help and time.

Thanks

Responses