Tuscany Simple Callback Sample

Overview

The Tuscany Simple Callback sample illustrates a simple asynchronous callback scenario, similar to the one illustrated in the Client and Implementation Model for Java SCA specification. Two atomic components are wired together that implement a bi-directional interface. The component definitions are given implicitly by the Java code and the use of @Callback annotations.

Location

This sample is located  in the samples\standalone\simplecallback directory. All the following commands should be issued while working in the sample directory.

Prerequisites

Obtain the following prerequisites and install according to their documentation.

Building

To build the sample  issue :

mvn

The result after executing is in the target subdirectory the sample-simplecallback.jar

Setup

Set up the Tuscany standalone runtime environment using the following command:

mvn dependency:unpack 

After completion there should be a target\distribution subdirectory created that has the Tuscany standalone runtime.

Running

Execute the following command: (cut and paste to command line)

java -jar target/distribution/bin/launcher.jar target/sample-simplecallback.jar

Results

The sample when run should simply display to the standard output:

Main thread Thread[main,5,main]
Work thread Thread[pool-1-thread-1,5,main]
Result: -> someMethod -> receiveResult