You can invoke an operation using JMS user property operation
selection.
About this task
The JMS user property operation selection is a predefined
operation selector that determines the target operation from the value
of a given JMS user property. You can define the name of the JMS user
property using the propertyName attribute of the operationSelector.jmsUserProp element.
To specify the JMS user property operation selection, add the following
operation selection element to the composite definition file:
OSOA
{http://tuscany.apache.org/xmlns/sca/1.0}operationSelector.jmsUserProp
OASIS
{http://tuscany.apache.org/xmlns/sca/1.1}operationSelector.jmsUserProp
Specify
a JMS user property operation selection on an SCA service interface
and on an SCA reference.
- In a composite definition file, specify a JMS user property
operation selection on an SCA service interface.
On
the service side, the jmsUserProp operation selection
uses the value of the given JMS user property to determine the target
operation. For example:
<binding.jms>
...
<ts:operationSelector.jmsUserProp propertyName="jmsTestUserProp"/>
...
</binding.jms>
The operation selector requires
that you set a JMS user property to the target operation name. If
the property is not set or there is no matching operation, the operation
selector does not default to any other value, unlike the default JMS
binding operation selector.
- In a composite definition file, specify a JMS user property
operation selection on an SCA reference.
When using
the JMS user operation selector on the service side, the reference
side or service side callback must set the matching JMS user property.
In the service-side example, the operation selector uses the value
of the jmsTestUserProp to determine the target operation.
You can set this property for the reference or callback side by specifying
one or more header properties in the operationProperties element;
for example:
<operationProperties name="proxyMethodName">
<headers>
<property name="jmsTestUserProp">remoteMethodName</property>
</headers>
</operationProperties>
In the example, a call to the proxyMethodName on
the reference side sets the jmsTestUserProp user
property to remoteMethodName. The proxyMethodName target
operation is set to remoteMethodName when the service-side
operation selector is configured as in the previous section.
What to do next
Deploy and test the operation selection in your SCA application.