<binding.jms>
The Tuscany Java SCA runtime supports the Java Messaging Service using the <binding.jms> SCDL extension. New JMS based service endpoints can be provided using a <binding.jms> element within a SCA <service>, existing JMS queues can be accessed using a <binding.ws> element within a SCA <reference>.
The JMS binding is one of the SCA extensions which is being formalized in the OASIS Open Composite Services Architecture with a published specifications document.
The JMS binding SCDL has the following format:
SCDL Content Supported Default Value ============ ========= ============== <binding.jms correlationScheme="string"? NO requestmsgidtocorrelid initialContextFactory="xs:anyURI"? YES org.apache.activemq.jndi.ActiveMQInitialContextFactory jndiURL="xs:anyURI"? YES tcp://localhost:61616 requestConnection="QName"? NO responseConnection="QName"? NO operationProperties="QName"? NO ... > <destination name="xs:anyURI" YES NODESTINATION (= target service name when not set) type="string"? NO queue create="string"?> YES never (set to allways if no destination set) <property name="NMTOKEN" type="NMTOKEN">* NO </destination>? <connectionFactory name="xs:anyURI" YES ConnectionFactory create="string"?> NO never <property name="NMTOKEN" type="NMTOKEN">* NO </connectionFactory>? <activationSpec name="xs:anyURI" NO create="string"?> NO <property name="NMTOKEN" type="NMTOKEN">* NO </activationSpec>? <response> <destination name="xs:anyURI" YES NORESPONSEDESTINATION (= reference name when not set) type="string"? NO queue create="string"?> YES never (set to allways if no response destination set) <property name="NMTOKEN" type="NMTOKEN">* NO </destination>? <connectionFactory name="xs:anyURI" YES ConnectionFactory create="string"?> NO never <property name="NMTOKEN" type="NMTOKEN">* NO </connectionFactory>? <activationSpec name="xs:anyURI" NO create="string"?> NO <property name="NMTOKEN" type="NMTOKEN">* NO </activationSpec>? </response>? <resourceAdapter name="NMTOKEN">? NO <property name="NMTOKEN" type="NMTOKEN">* NO </resourceAdapter>? <headers JMSType="string"? NO JMSCorrelationId="string"? NO JMSDeliveryMode="string"? NO DeliveryMode.NON_PERSISTENT JMSTimeToLive="int"? NO 10000 JMSPriority="string"?> NO 1 <property name="NMTOKEN" type="NMTOKEN">* </headers>? <operationProperties name="string" NO nativeOperation="string"?> NO <property name="NMTOKEN" type="NMTOKEN">* NO <headers JMSType="string"? NO JMSCorrelationId="string"? NO JMSDeliveryMode="string"? NO JMSTimeToLive="int"? NO JMSPriority="string"?> NO <property name="NMTOKEN" type="NMTOKEN">* NO </headers>? </operationProperties>* </binding.jms>
see JMS Binding S Vpecification 1.0 for deatils of each of these configuration options.
Binding Operation
<binding.jms>
Some examples:
Creating Queues
By default the JMS binding assumes queue based option where a queue represents a single wire between two components. In this mode operation is assumed to be RPC by default, i.e. the referen will send a message and wait for a response. The name of the response queue is passed to the service along with the message but the desitination queue name must match a reference and service
<component name="HelloWorldClientComponent"> <implementation.java class="org.apache.tuscany.sca.binding.jms.HelloWorldClientImpl"/> </component> <reference name="HelloWorldReference" promote="HelloWorldClientComponent/service"> <interface.java interface="org.apache.tuscany.sca.binding.jms.HelloWorldService"/> <binding.jms initialContextFactory="org.apache.activemq.jndi.ActiveMQInitialContextFactory" jndiURL="tcp://localhost:61616"> <destination name="DestQueue" create="always"/> <response> <destination name="RespQueue" create="always"/> </response> </binding.jms> </reference> <service name="HelloWorldService" promote="HelloWorldServiceComponent"> <interface.java interface="org.apache.tuscany.sca.binding.jms.HelloWorldService"/> <binding.jms initialContextFactory="org.apache.activemq.jndi.ActiveMQInitialContextFactory" jndiURL="tcp://localhost:61616"> <destination name="DestQueue" create="always"/> </binding.jms> </service> <component name="HelloWorldServiceComponent"> <implementation.java class="org.apache.tuscany.sca.binding.jms.HelloWorldServiceImpl"/> </component>