JBoss Community Archive (Read Only)

SwitchYard

SCA

The SCA binding provides a means by which SwitchYard services and SwitchYard-aware clients can communicate with one another.  There are three basic use cases for the SCA binding:

  1. Facilitate inter-application communication within a SwitchYard runtime.  The SCA binding can be used to link a composite reference in one application to a composite service in another application.

  2. Provide a remote invocation endpoint for external clients using RemoteInvoker.  This allows a stand-alone client to communicate with a SY application.

  3. Allow clustering of SwitchYard services in two or more SwitchYard instances.

SCA Service Bindings

An SCA binding can be added to composite-level services to make that service available to other applications and remote clients through a SwitchYard internal communication protocol.

images/author/download/attachments/63636205/binding-sca-service.jpg

There is only one configuration option available for SCA bindings:

  • clustered : when enabled, the service will be published in the distributed SY runtime registry so that other cluster instances can discover and consume the service.

Regardless of the clustering setting, all services with an SCA binding are invokable through the SwitchYard remote invoker endpoint.  The default URL for this endpoint is http://localhost:8080/switchyard-remote. The hostname and port for this endpoint are based on the default HTTP listener defined in AS 7.

SCA Reference Bindings

An SCA binding can be added to a composite-level reference to invoke services provided in other SwitchYard applications deployed locally or in a cluster.

images/author/download/attachments/63636205/binding-sca-reference.jpg

The following configuration parameters can be used with an SCA reference binding:

  • clustered : if enabled, the reference binding will discover remote SY service endpoints in a cluster.

  • load balancing : the name of a load balancing strategy to be used with clustering.  Two out of the box options available are "RoundRobinStrategy" and "RandomStrategy".  You can also specify a custom load balance strategy by implementing LoadBalanceStrategy.

  • target service : allows you to override the name of the service being invoked in the case where the target application uses a service name different from the reference name (default is that reference and service name match).

  • target namespace : allows you to override the namespace of the service being invoked.  By default, all applications in SwitchYard use a different namespace, so keep this setting in mind when invocations occur across application boundaries.

Remote Transaction Propagation

If you invoke remote SwitchYard service via SCA binding under the active JTA transaction, SwitchYard runtime propagates its transaction context. Let's say we have ServiceA and ServiceB, where ServiceA is deployed on NodeA and ServiceB is on NodeB. ServiceA invokes ServiceB via SCA reference binding besides. If ServiceA is processing under the active JTA transaction, SwitchYard runtime embeds its transaction context into the remote invocation message when ServiceA invokes ServiceB. Then ServiceB extracts that transaction context and create subordinate JTA transaction, which means ServiceB is processed under the subordinate transaction of ServiceA's transaction, so those transactions could synchronize. Please note that transaction policy must allow this behavior on both sides of ServiceA and ServiceB.

In order to achieve this remote transaction propagation, XTS must be enabled in AS 7 configuration. Following changes should be applied:

--- standalone-ha.xml	2013-10-09 22:09:32.085300978 +0900
+++ standalone-ha-xts.xml	2013-10-16 11:40:57.198147545 +0900
@@ -25,6 +25,7 @@
         <extension module="org.jboss.as.webservices"/>
         <extension module="org.jboss.as.weld"/>
         <extension module="org.switchyard"/>
+        <extension module="org.jboss.as.xts"/>
 </extensions>
 <management>
    <security-realms>
@@ -405,6 +406,9 @@
    <extension identifier="org.apache.camel.soap"/>
    </extensions>
 </subsystem>
+<subsystem xmlns="urn:jboss:domain:xts:1.0">
+   <xts-environment url="http://${jboss.bind.address:127.0.0.1}:8080/ws-c11/ActivationService"/>
+</subsystem>
 </profile>
     <interfaces>
         <interface name="management">
JBoss.org Content Archive (Read Only), exported from JBoss Community Documentation Editor at 2020-03-13 09:45:44 UTC, last content change 2013-11-06 12:25:38 UTC.