33.4. The Beans

The simple bean on JOnAS A needs to connect to its local JORAM server and access the remote queue. The following is an example of consistent resource definitions in the deployment descriptors:

Standard deployment descriptor:

<resource-ref>
  <res-ref-name>jms/factory</res-ref-name>
  <res-type>javax.jms.ConnectionFactory</res-type>
  <res-auth>Container</res-auth>
</resource-ref>
<resource-env-ref>
  <resource-env-ref-name>
     jms/sharedQueue
  </resource-env-ref-name>
  <resource-env-ref-type>
     javax.jms.Queue
  </resource-env-ref-type>
</resource-env-ref>

Specific deployment descriptor:

<jonas-resource>
  <res-ref-name>jms/factory</res-ref-name>
  <jndi-name>CF</jndi-name>
</jonas-resource>
<jonas-resource-env>
  <resource-env-ref-name>
     jms/sharedQueue
  </resource-env-ref-name>
  <jndi-name>scn:comp/sharedQueue</jndi-name>
</jonas-resource-env>

The ConnectionFactory is retrieved from the local JNDI registry of the bean. However, the Queue is retrieved from the distributed JORAM JNDI server because its name starts with the scn:comp/ prefix. It is the same queue to which the Message-Driven Bean on JOnAS B listens. To do this, its activation properties should be set as follows:

<activation-config>
   <activation-config-property>
      <activation-config-property-name>
         destination
      </activation-config-property-name>
      <activation-config-property-value>
         scn:comp/sharedQueue
      </activation-config-property-value>
   </activation-config-property>
   <activation-config-property>
      <activation-config-property-name>
         destinationType
      </activation-config-property-name>
      <activation-config-property-value>
         javax.jms.Queue
      </activation-config-property-value>
   </activation-config-property>
</activation-config>