[esb-dev] jca integration

Bill Burke bburke at redhat.com
Tue May 15 19:26:09 EDT 2007


Ok, did 1st stage of JCA Gateway.  I'll commit that tomorrow morning. 
Still need to do schema change to add jca elements.

Here's what a JCA endpoint looks like:

public class MyEndpointBean implements InflowGateway, MessageListener
{
    private ServiceInvoker service;

    public void setServiceInvoker(ServiceInvoker invoker)
    {
       this.service = invoker;
    }

    public void onMessage(Message message)
    {
       try
       {
          // convert the message ...
          service.postMessage(esbMessage);
       }
       catch (Exception e)
       {
          throw new RuntimeException(e);
       }
    }
}

The InflowGateway interface has one method:  setServiceInvoker(). The 
ServiceInvoker allows you to post ESB messages to the target service's 
EPR.  The ServiceInvoker is created by the ESB container and passed to 
the endpoint bean in the initialization phase.  The endpoint bean is a 
singleton.  I did it this way for a couple of reasons:

* I wanted to reduce the amount of artifacts people needed to write. 
The endpoint bean needs to receive inbound messages as well as be able 
to transform the message into an ESB message and push it along.  This 
means I didn't want to have a specific Transformer class like the other 
gateways have.

* I made the endpoint bean a singleton to be consistent with the action 
framework model.  If the user wants per instance and/or instance 
pooling, they should use an MDB or the Spring bullshit equivalent.



Next steps?

Schema changes to add JCA elements.  Here's what I was thinking:

<providers>
   <jca-bus busid="JMS-Inflow-Bus"
            adapter="jms-ra.rar"
            endpointClass="org.test.MyEndpointBean"
            messagingType="javax.jms.MessageListener"
            jcaBridge="org.jboss.gateway.jca.JBoss42ActivationBridge">
      <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>
   </jca-bus>
</providers>

<services>

       <service category="HelloWorld_ActionESB"
                name="SimpleListener"
                description="Hello World">
          <listeners>
             <jca-gateway busid="JMS-Inflow-Bus" ...>
               ... same thing as jca-inflow-bus ...
             </jca-gateway>

The messageType is optional.  If it is not specified, the ESB container 
will guess what it is.  The jcaBridge is optional.  This class is an SPI 
for plugging in the JCA code into other app servers.  Only JBoss is 
supported now obviously.

The <activation-config> syntax was stolen from EJB.  Should we simplify 
it?  Or leave it consistent with EJB?

The <jca-gateway> syntax is allowed to override/augment any <jca-bus> 
configuration.

Since raw JCA would be inbound only, again, I don't think it makes sense 
to require a bus definition in the schema.  There really isn't much 
re-use to gain.


-- 
Bill Burke
JBoss, a division of Red Hat Inc.



More information about the esb-dev mailing list