Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Section
bordertrue
Column
width15%
Include Page
TUSCANY: SCA Java Subproject Menu
TUSCANY: SCA Java Subproject Menu
Include Page
TUSCANY: Java SCA Menu New
TUSCANY: Java SCA Menu New
Column
width85%
Note
title:Notification
title:Notification
Center

Distributed SCA Domain

Using a distributed SCA domain that works across multiple JVMs is not much harder than using the Standalone SCA Domain.

Image Modified

Here each running node has to have a representation of the domain so we create and an instance of

Code Block
org.apache.tuscany.sca.domain.SCADomain.

Note that the package name is different compared to the standalone SCA domain. This time we are dealing with a distributed domain rather than an embedded a standalone domain.

Again there are a number of newInstance() operations to choose from. The first two are the same as in the standalone case

Code Block
public static SCADomain newInstance() 

Starts a standalone domain with a default domain URI and will treat the classpath as the contribution to this domain. All .composite files on the classpath will will read any deployable components created accordingly.

Deployable components are defined by either

1/ placing the .compostie composite file in the META-INF/sca-deployables/directory
2/ By specifying the composite as deployable in the META-INF/sca-contribution.xml file

Code Block

    public static SCADomain newInstance(String composite)

Starts a standalone domain with a default domain URI and will try and find the named composite file in the classpath and use it's location as the contribution location. It will deploy the named composite.

The third variation has changed to take account of the distributed domain.

Code Block
public static SCADomain newInstance(String domainURI, String nodeURI, String contributionLocation, String... composites)

This starts a local node with the identifier "nodeURI". This must be a unique uri that identifies this node. If this uri is a valid url of the form http://hostname:portnumber/It it is used by the node implementation as the root address for the management services that the node starts up.

In the future, when distributed domain support has been enabled in webapps, this will also indicate to SCA what the host name and port number of the web app container eris.

The domainURI is the URL of the domain manager. This is a separate java application that the nodes contact in order to register service information and in order to find information about other services in the domain.

The contributionLocation and composite parameters are as before.

When the node starts is will will load the contribution, deploy any deployable composites and then register information about any external services with the domain manager.

We can see how this works by taking a look at the calculator-distributed sample.

Image Modified

We have a sample domain node manager implementation in the calculator-distributed sample. If you go to the sample you can run this using the following command

Code Block
ant runDomainNode

This starts some domain management services at the endpoint http://myhost:8877. So the domain name in this case is http://myhost:8877.

If you take a look at node.CalculatorNode.java you can see how a each node in the domain is started.

Code Block
SCADomain scaDomain = SCADomain.newInstance(domainName, nodeName, null, nodeName + "/Calculator.composite");

Where domainName will be "http://myhost:8877" and the node name will be "nodeA" or "nodeB" or "nodeC". In the calculator-distributed sample you can start the node implementation using the ant build file again, for example

Code Block
ant RunNode http://localhost:8877 nodeB

Once started we can used the SCADomain interface as before. For example, a service proxy can be created and an operation called.

Code Block
CalculatorService calculatorService = scaDomain.getService(CalculatorService.class, "CalculatorServiceComponent");
double result = calculatorService.add(3, 2));

Putting this all together the following picture gives an idea of what is going on under the covers.

Image Modified(warning) TBD - more to add re reference inside and outside the domain and the SCA Binding etc.