Resending... The original message never showed up in the archives so I'm
assuming it didn't get through.

A couple of additional notes

1) I found Guillaume Nodet's patch for the null username/password
problem in Generic RA on one of the Generic RA mailing lists.

2) The SessionAdapter class has a whole bunch of methods that should
probably be patched similarly to my change below -- I only changed the
one that affected me (for queues).

Cheers,
Raman

-------- Original Message --------
Subject: Re: [jencks-user] Re:[jencks-user] Outbound connections
Date: Thu, 15 Sep 2005 14:00:11 -0400
From: Raman Gupta <[EMAIL PROTECTED]>
To: [email protected]
References: <[EMAIL PROTECTED]>
<[EMAIL PROTECTED]>

Raman Gupta wrote:
> [EMAIL PROTECTED] wrote:
> 
>>The main problem with the generic ra is that it can not be
>>used (currently) from a spring application : you should have
>>an NullPointerException somewhere.  This issue has been
>>reported on their list and i hope it will be corrected soon.
>> In the mean time, i'll try to compile a modified version of
>>genericra and to put it in the jencks source tree.
> 
> 
> Yes, you're right, I'm getting an NPE. I saw your patch on the genericra
> list. Later on today I'm going to apply it and try it again.

The generic RA outbound messaging works! Note that it is not yet heavily
tested. The following Spring config was sufficient (I am using WebSphere
MQ as the underlying JMS provider, I don't need XA so I turned it off):

  <bean id="jencksMq" class="org.jencks.JCAContainer">
    <property name="bootstrapContext">
      <bean class="org.jencks.factory.BootstrapContextFactoryBean">
        <property name="threadPoolSize" value="10"/>
      </bean>
    </property>
    <property name="resourceAdapter" ref="mqResourceAdapter"/>
  </bean>
  <bean id="mqResourceAdapter" class="com.sun.genericra.GenericJMSRA">
    <property name="queueConnectionFactoryClassName"
              value="com.ibm.mq.jms.MQQueueConnectionFactory"/>
    <property name="queueClassName" value="com.ibm.mq.jms.MQQueue"/>
    <property name="supportsXA" value="false"/>
    <property name="providerIntegrationMode" value="javabean"/>
  </bean>
  <bean id="mqConnectionFactory"
class="org.springframework.jca.support.LocalConnectionFactoryBean">
    <property name="managedConnectionFactory">
      <bean
        class="com.sun.genericra.outbound.ManagedJMSConnectionFactory">
        <property name="resourceAdapter">
          <ref local="mqResourceAdapter"/>
        </property>
        <property name="connectionFactoryClassName"
          value="com.ibm.mq.jms.MQConnectionFactory"/>
        <property name="connectionFactoryProperties"
value="TransportType=1,QueueManager=QM,HostName=HOST,Channel=CHNL" />
        <property name="queueClassName" value="com.ibm.mq.jms.MQQueue"/>
        <property name="supportsXA" value="false"/>
        <property name="providerIntegrationMode" value="javabean"/>
      </bean>
    </property>
  </bean>

  <bean id="genericMqTemplate"
        class="org.springframework.jms.core.JmsTemplate">
    <property name="connectionFactory" ref="mqConnectionFactory"/>
  </bean>

In order to get this working, I had to make two minor modifications to
the genericra code:

1) Guillaume's patch to handle null username/passwords.

2) The SessionAdapter.getWrappedDestination() method was attempting to
cast a javax.jms.Queue implementation incorrectly. So I modified the
method to be:

if (dest instanceof com.sun.genericra.outbound.DestinationAdapter) {
    return
(javax.jms.Destination)(((com.sun.genericra.outbound.DestinationAdapter)dest)._getPhysicalDestination());
} else {
   return dest;
}

Cheers,
Raman

Reply via email to