Tuscany Hello World JMS Service Sample
Overview
The Tuscany hello world jms sample shows using the Tuscany SCA runtime using the Celtix/J2SE environment to provide a web service using
XML over JMS as well as SOAP over HTTP.
Location
This sample is located in the samples\sca\helloworld-jms\server
directory.
Setup
This sample depends on the Tuscany runtime, Celtix, and the sample jar,
sample-helloworldjms-service-incubating-M1.jar
, all of these must be available on the classpath to run the sample.
Running
In the directory samples/sca/helloworld-jms/server use the JDK 1.5 java command to start the JMS broker and then run the class helloworld.HelloWorldServer.
Linux:
java -cp ../../../../lib/tuscany-runtime-incubating-M1.jar:../../../../lib/celtix/tuscany-celtix-incubating-M1.jar org.activemq.spring.Main activemq.xml
java -cp ../../../../lib/tuscany-runtime-incubating-M1.jar:../../../../lib/celtix/tuscany-celtix-incubating-M1.jar:target/sample-helloworldjms-service-incubating-M1.jar helloworld.HelloWorldServer
Windows:
java -cp ../../../../lib/tuscany-runtime-incubating-M1.jar;../../../../lib/celtix/tuscany-celtix-incubating-M1.jar org.activemq.spring.Main activemq.xml
java -cp ../../../../lib/tuscany-runtime-incubating-M1.jar;../../../../lib/celtix/tuscany-celtix-incubating-M1.jar;target/sample-helloworldjms-service-incubating-M1.jar helloworld.HelloWorldServer
Code Overview
The source files are physically organized as shown below:
+---main
+---java
¦ +---helloworld
¦ HelloWorldServer.java
¦ HelloWorldImpl.java
¦ HelloWorldService.java
+---resources
¦ sca.module
+---wsdl
helloworld.wsdl
activemq.xml
|
HelloWorldServer.java |
Main method to startup the Tuscany runtime which will startup the services defined in sca.module |
HelloWorldService.java |
Defines the Java interface implemented by the component. |
HelloWorldImpl.java |
Implements the SCA component. Uses the SCA service annotation
tag on the class to show what SCA interface is being implemented. |
sca.module |
Defines the SCA module, entryPoint and component.
Defines for the HelloWorldServiceComponent component and the Java class that
implements the component For the entryPoint it defines WSDL for the service, the
Java interface provided by the service, and wires the service to the HelloWorldServiceComponent |
helloworld.wsdl |
WSDL for the service. |
activemq.xml |
Configuration file for ActiveMQ to setup the broker |