The JCA gateway allows you to send and receive messages to/from EIS via JCA ResourceAdapter.
Binding Services with JCA message inflow
Composite-level services can be bound to a EIS with JCA message inflow using the <binding.jca> binding definition. The following configuration options are required for binding.jca:
Here's an example of what a JCA service binding looks like. This example binds a service to the HornetQ JMS:
<sca:composite name="JCAInflowExample" targetNamespace="urn:userguide:jca-example-service:0.1.0">
<sca:service name="JCAService" promote="SomeService">
<jca:binding.jca>
<selector:operationSelector operationName="onMessage"/>
<jca:inboundConnection>
<jca:resourceAdapter name="hornetq-ra.rar"/>
<jca:activationSpec>
<jca:property name="destinationType" value="javax.jms.Queue"/>
<jca:property name="destination" value="ServiceQueue"/>
</jca:activationSpec>
</jca:inboundConnection>
<jca:inboundInteraction>
<jca:listener>javax.jms.MessageListener</jca:listener>
<jca:endpoint type="org.switchyard.component.jca.endpoint.JMSEndpoint"/>
<jca:transacted>true</jca:transacted>
<jca:batchCommit batchSize="10" batchTimeout="5000"/>
</jca:inboundInteraction>
</jca:binding.jca>
</service>
<!-- sca:component definition omitted -->
</sca:composite>
Binding References with JCA outbound
Composite-level references can be bound to a EIS with JCA outbound using the <binding.jca> binding definition. The following configuration options are required for binding.jca:
-
outboundConnection
-
resourceAdapter
-
connection
-
outboundInteraction
-
connectionSpec : Configuration for javax.resource.cci.ConnectionSpec. Note that JMSProcessor doesn't use this option.
-
interactionSpec : Configuration for _javax.resource.cci.InteractionSpec. _Note that JMSProcessor doesn't use this option.
-
processor
-
@type : FQN of the class which processes outbound delivery. There are 2 build-in processor, org.switchyard.component.jca.processor.JMSProcessor and org.switchyard.component.jca.processor.CCIProcessor. If neither JMSProcessor nor CCIProcessor is applicable for the EIS you're supposed to bind to, then you need to implement its own processor class according to the ResourceAdapter implementation. Note that this class should be a subclass of org.switchyard.component.jca.processor.AbstractOutboundProcessor.
-
property : Properties to be injected into processor instance. JMSProcessor needs destination property to specify target destination. CCIProcessor needs recordClassName property to specify record type to be used to interact with EIS. If you use CCIProcessor with the record type other than MappedRecord and IndexedRecord, you need to implement corresponding RecordHandler. Please refer to org.switchyard.component.jca.processor.cci.IndexedRecordHandler and org.switchyard.component.jca.processor.cci.MappedRecordHandler.
Here's an example of what a JCA reference binding looks like. This example binds a reference to the HornetQ JMS:
<sca:composite name="JCAReferenceExample" targetNamespace="urn:userguide:jca-example-reference:0.1.0">
<sca:reference name="JCAReference" promote="SomeComponent/SomeReference" multiplicity="1..1">
<jca:binding.jca>
<jca:outboundConnection>
<jca:resourceAdapter name="hornetq-ra.rar"/>
<jca:connection jndiName="java:/JmsXA"/>
</jca:outboundConnection>
<jca:outboundInteraction>
<jca:processor type="org.switchyard.component.jca.processor.JMSProcessor">
<jca:property name="destination" value="ReferenceQueue"/>
</jca:processor>
</jca:outboundInteraction>
</jca:binding.jca>
</sca:reference>
</sca:composite>