1
votes

I'm trying to understand what config properties do I really need to make an MDB deployed on JBoss 5 process messages from a queue set up on a remote JMS provider. I'm planning to configure the activation spec using the ejb-jar.xml, and I wan't to configure only what I really need, not more. My understanding is that the allowed config for the spec is configured in the ra.xml in use. If I look for the ra.xml from jms-ra.rar I can see the below inbound-resourceadapter element

  <inbound-resourceadapter>
     <messageadapter>        
        <messagelistener>
           <messagelistener-type>javax.jms.MessageListener</messagelistener-type>
           <activationspec>
              <activationspec-class>org.jboss.resource.adapter.jms.inflow.JmsActivationSpec</activationspec-class>
              <required-config-property>
                  <config-property-name>destination</config-property-name>
              </required-config-property>
           </activationspec>
        </messagelistener>
     </messageadapter>
  </inbound-resourceadapter>

only the destination property is mandatory. In my case this destination is remote, therefore I did configure a JMSProviderLoader with the necessary JNDI properties and also a connection factory that references this JMSProviderLoader, both in a new [myprovidername]-ds.xml file I added to deploy. I cannot understand how if I only add a destination will the MDB know it is from that specific remote JMS provider, I do see that the outbound-resourceadapter element from ra.xml specifies the below:

<config-property>
   <description>The jndi name of the provider of connection factories</description>
   <config-property-name>JmsProviderAdapterJNDI</config-property-name>
   <config-property-type>java.lang.String</config-property-type>
   <config-property-value>java:DefaultJMSProvider</config-property-value>
</config-property>

But judging from the word outgoing, this would not apply to inbound flows.

In summary, to enable an MDB to listen, do I only need destination? If so, how does it know what JMS provider this is from given that I could have multiple providers with same destination name?

Thanks

1

1 Answers

1
votes

The magic comes with the Activation Spec that is configured in the inbound-resourceadapter:

<activationspec-class>org.jboss.resource.adapter.jms.inflow.JmsActivationSpec</activationspec-class>

Looking into the source shows, that java:/DefaultJMSProvider is hard set as default for the providerAdapterJNDI, so this one is used automagically, same as explicitly configured for the outbound part.

So you only need a destination as mandatory property because all else has a viable default in JmsActivationSpec.

As long as you name your own JMSProviderLoader to be the "Default" one in your *-ds.xml, everything works fine:

<attribute name="ProviderName">DefaultJMSProvider</attribute>

Otherwise you would have to set the according attribute explicitly in your activation spec for the MDB.