JBoss Community

Re: WebSphere MQ issue

created by Rod Biresch in IronJacamar - View the full discussion

Below is the configuration that my app is using.  There's more information there than you need.  I had to "clean" it somewhat before posting so hopefully I didn't make any mistakes.  I use token replacement {$...} with JVM properties in the jboss.xml so that I don't have to hard code WSMQ configuration when deploying to different environments.

 

=======

jboss.xml (bundled in your app)

=======

 

<?xml version="1.0"?>

<!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS 4.2//EN" "http://www.jboss.org/j2ee/dtd/jboss_4_2.dtd">

<jboss>

  <enterprise-beans>

                    <session>

                              <ejb-name>RemoteSystem</ejb-name>

                              <resource-ref>

                                        <res-ref-name>jdbc/DataSource</res-ref-name>

                                        <jndi-name>java:/DataSource</jndi-name>

                              </resource-ref>

                              <resource-ref>

                                        <res-ref-name>jms/WSMQCF</res-ref-name>

                                        <jndi-name>java:/WSMQCF</jndi-name>

                              </resource-ref>

                              <message-destination-ref>

                                        <message-destination-ref-name>jms/Queue</message-destination-ref-name>

                                        <jndi-name>java:/RemoteSystemQueue</jndi-name>

                              </message-destination-ref>

                    </session>

<!-- more bean configuration here-->

    <message-driven>

      <ejb-name>MessageProcessor</ejb-name>

      <activation-config>

        <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-property>

          <activation-config-property-name>useJNDI</activation-config-property-name>

          <activation-config-property-value>false</activation-config-property-value>

        </activation-config-property>

        <activation-config-property>

          <activation-config-property-name>destination</activation-config-property-name>

          <activation-config-property-value>${mq.incoming.queue}</activation-config-property-value>

        </activation-config-property>

        <activation-config-property>

          <activation-config-property-name>channel</activation-config-property-name>

          <activation-config-property-value>${mq.channel}</activation-config-property-value>

        </activation-config-property>

        <activation-config-property>

          <activation-config-property-name>hostName</activation-config-property-name>

          <activation-config-property-value>${mq.hostname}</activation-config-property-value>

        </activation-config-property>

        <activation-config-property>

          <activation-config-property-name>port</activation-config-property-name>

          <activation-config-property-value>${mq.port}</activation-config-property-value>

        </activation-config-property>

        <activation-config-property>

          <activation-config-property-name>queueManager</activation-config-property-name>

          <activation-config-property-value>${mq.mgrname}</activation-config-property-value>

        </activation-config-property>

        <activation-config-property>

          <activation-config-property-name>transportType</activation-config-property-name>

          <activation-config-property-value>CLIENT</activation-config-property-value>

        </activation-config-property>

      </activation-config>

      <resource-adapter-name>wmq.jmsra.rar</resource-adapter-name>

      <configuration-name>Standard Message Inflow Driven Bean</configuration-name>

      <!-- use the a JMS invoker bindings for message inflow driven beans -->

      <invoker-bindings>

        <invoker>

          <invoker-proxy-binding-name>message-inflow-driven-bean</invoker-proxy-binding-name>

        </invoker>

      </invoker-bindings>

      <resource-ref>

        <res-ref-name>jms/WSMQCF</res-ref-name>

        <jndi-name>java:/WSMQCF</jndi-name>

      </resource-ref>

      <message-destination-ref>

        <message-destination-ref-name>jms/ExceptionQueue</message-destination-ref-name>

        <jndi-name>java:/ExceptionQueue</jndi-name>

      </message-destination-ref>

    </message-driven>

  </enterprise-beans>

</jboss>

 

=======

wmq.jmsra-ds.xml

=======

 

 

<?xml version="1.0" encoding="UTF-8"?>

 

 

<connection-factories>

 

  <!-- ==================================================================== -->

  <!-- WebSphere MQ JMS/JCA Configuration                                                                               -->

  <!-- ==================================================================== -->

 

  <mbean code="org.jboss.resource.deployment.AdminObject"

      name="jca.wmq:name=sendtoqueue">

 

 

    <!-- Bind this AdminObject  with the JNDI name ToRemoteSystemQueue -->

    <attribute name="JNDIName">java:ToRemoteSystemQueue</attribute>

 

 

    <!-- this MBean depends on the WebSphere MQ resource adapter -->

    <depends optional-attribute-name="RARName">

      jboss.jca:service=RARDeployment,name='wmq.jmsra.rar'

    </depends>

 

 

    <!-- this admin object is a javax.jms.Queue -->

    <attribute name="Type">javax.jms.Queue</attribute>

 

 

    <attribute name="Properties">

      baseQueueManagerName=QM

      baseQueueName=SEND.TO.QUEUE

    </attribute>

  </mbean>

 

  <mbean code="org.jboss.resource.deployment.AdminObject"

      name="jca.wmq:name=exceptionqueue">

 

 

    <!-- Bind this AdminObject  with the JNDI name ExceptionQueue -->

    <attribute name="JNDIName">java:ExceptionQueue</attribute>

 

 

    <!-- this MBean depends on the WebSphere MQ resource adapter -->

    <depends optional-attribute-name="RARName">

      jboss.jca:service=RARDeployment,name='wmq.jmsra.rar'

    </depends>

 

 

    <!-- this admin object is a javax.jms.Queue -->

    <attribute name="Type">javax.jms.Queue</attribute>

 

 

      <attribute name="Properties">

      baseQueueManagerName=QM

      baseQueueName=EXCEPTION

    </attribute>

  </mbean>

 

  <!-- JMS XA Resource adapter, use this to get transacted JMS in beans -->

  <tx-connection-factory>

       <!-- Bind this ConnectionFactory with the JNDI name WSMQCF -->

    <jndi-name>WSMQCF</jndi-name>

 

 

    <!-- Indicate that the connection factory supports XA transactions -->

    <xa-transaction />

 

 

    <!-- rar-name is the actual RAR file name, in this case wmq.jmsra.rar -->

    <rar-name>wmq.jmsra.rar</rar-name>

 

 

    <!-- connection-definition is the ConnectionFactory interface

      defined in the ra.xml -->

    <connection-definition>javax.jms.ConnectionFactory</connection-definition>

 

 

    <!--

        Configuration for the ConnectionFactory. This defines the channel, hostname, port,

        queueManager, and transportType properties for a client (TCP/IP) connection to WMQ

    -->

    <config-property name="channel" type="java.lang.String">JAVA.CHANNEL</config-property>

    <config-property name="hostName" type="java.lang.String">hostname</config-property>

    <config-property name="port" type="java.lang.String">1415</config-property>

    <config-property name="queueManager" type="java.lang.String">QM</config-property>

    <config-property name="transportType" type="java.lang.String">CLIENT</config-property>

   

    <max-pool-size>20</max-pool-size>

 

 

    <!-- define security domain -->

    <security-domain-and-application>JmsXARealm</security-domain-and-application>

 

 

  </tx-connection-factory>

 

 

</connection-factories>

=======

 

Here are a couple of resources that will help with configuration:

 

http://www.ibm.com/developerworks/websphere/library/techarticles/0710_ritchie/0710_ritchie.html

http://community.jboss.org/wiki/UsingWebSphereMQSeriesWithJBossASPart4

http://www-01.ibm.com/support/docview.wss?uid=pub1sc34692800

 

Cheers!

Reply to this message by going to Community

Start a new discussion in IronJacamar at Community