You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Unable to render {include} The included page could not be found.
Unable to render {include} The included page could not be found.

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

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

org.apache.tuscany.sca.domain.SCADomain.

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

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

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 file in the META-INF/sca-deployables/directory

2/ By specifying the composite as deployable in the META-INF/sca-contribution.xml file

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.

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 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 er.

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 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.

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

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 node is started.

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

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.

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.

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

  • No labels