previous next trail start tutorial home feedback openwings.org

Writing Hello World

3. HelloWorldSubscriber

Source code: HelloWorldSubscriber.java

The HelloWorldSubscriber component will

  • Create a subscriber of the service
    • get a reference to a component
    • subscribe to the service (ie: implement the interface)

HelloWorldSubscriber is a client that receives data through the asynchronous connection from HelloWorldPublisher. It does this by obtaining a component object from componentFactory and subscribing itself:

ComponentFactory.getComponent().subscribeService(
HelloWorldServiceAsynchronous.class, this, this);

Like its synchronous counterpart, HelloWorldUser, this class represents the client side. Unlike its counterpart, this class implements the service interface (HelloWorldServiceAsynchronous). Through the method helloWorld(String hello), messages from the asynchronous connection are received.

public void helloWorld (String hello) throws RemoteException
{
  output(hello);
}

This class is also responsible for the display of the messages it receives. It creates a window where received messages are displayed.

Next: Compilation

back to top

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

previous next trail start tutorial home feedback openwings.org