previous next trail start tutorial home feedback openwings.org

Writing Hello World

HelloWorld Asynchronous

Conceptually what will happen in this asynchronous example is HelloWorldPublisher will "publish" the asynchronous service and HelloWorldSubscriber will "subscribe" to the service. The steps to do this are:

  1. Define the service interface - HelloWorldServiceAsynchronous.java
  2. Create a publisher of the service - HelloWorldPublisher.java
    • get a reference to the component
    • publish the service
  3. Create a subscriber of the service - HelloWorldSubscriber.java
    • get a reference to a component
    • subscribe to the service (ie: implement the interface)

1. HelloWorldServiceAsynchronous

Source code: HelloWorldServiceAsynchronous.java

The HelloWorldServiceAsynchronous is

  • the service interface that has been defined

Like the HelloWorldServiceSynchronous interface, the HelloWorldServiceAsynchronous interface is very simple. However, there are two main differences between them. The helloWorld() method in the HelloWorldSynchronous interface returns a String, whereas the helloWorld() method in the asynchronous interface does not. Also, the same method in the synchronous interface includes no parameters, while the method in the asynchronous interface includes a parameter, String hello.

void helloWorld (String hello) throws RemoteException;

These differences are due to how synchronous and asynchronous connectors work. See the Connector Generation section for more on this.

The HelloWorldServiceAnsynchronous interface in its entirety is linked above. This interface is implemented by HelloWorldSubscriber and the "Hello World!" messages are created by HelloWorldPublisher.

Next: HelloWorldPublisher

back to top

Copyright 2002, General Dynamics Decision Systems. All rights reserved.

previous next trail start tutorial home feedback openwings.org