This example uses a simple Notification Service Push model to broadcast and receive "news" across the event channel.
The news consists of stock market updates and weather reports for certain regions. There are people listening for this news, namely a weatherman and a stock market analyst.
StockQuote: The stock market sends real-time news across the channel of share information for companies. The news consists of the company name and the change in share price for that company.
Analyst: There is a stock market analyst who is interested in stock market news. However, the analyst is a busy man and he is only interested in important news (that is, news with a high priority).
WeatherStation: The weather station broadcasts news about weather changes around the country. The news consists of a region and the current weather in that region.
WeatherMan: The weatherman is interested in all news concerning weather.
This example uses structured push suppliers (stock market and weather station) and structured push consumers (the analyst and weatherman). The consumer-side proxies have filters attached to them, only allowing events through that are of a certain type and filtering out all other events passed over the channel that are not of this type.
The example uses a single event channel and the following classes:
Below is a diagram of how the example uses the Notification Service.
These instructions are based on the Solaris gcc3.2 compiler makefiles.
ACE_ROOT=<TAO install dir>; export ACE_ROOT
TAO_ROOT=<TAO install dir>; export TAO_ROOT
SHLIB_PATH=$TAO_ROOT/lib; export SHLIB_PATH
LD_LIBRARY_PATH=$TAO_ROOT/lib:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH
PATH=$PATH:$TAO_ROOT/bin; export PATH
INSLIB=$TAO_ROOT/lib; export INSLIB
PATH=/usr/local/gcc-3.2/bin:/usr/ccs/bin:$PATH; export PATH
LD_LIBRARY_PATH=/usr/local/gcc-3.2/lib:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH
<TAO install dir>/examples/cc
directory.
make
command to run the makefile. This will compile all of the OpenFusion examples.
TAO_ROOT=<TAO install dir>
where
<TAO install dir>
is the location into which you have installed
TAO.
<TAO install dir>\examples\examples.sln
. Double-click on the project file to load
it into
Microsoft Visual C++. For each of the projects lised below, change the project from debug
mode to release mode using the Build | Configuration Manager menu option.
UNIX: Ensure that the environment
variable LD_LIBRARY_PATH
includes the path to where the common files
and
the News files were compiled:
LD_LIBRARY_PATH=<TAO install dir>/examples/cc/Common:<TAO install dir>/examples/cc/Notification/news:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH
Windows NT: Start a DOS window. Ensure that your path contains:
<TAO
install dir>\bin;<TAO install dir>\examples\cc\bin
Ensure that the Notification Service is running. In order to run the OpenFusion Notification Service you must first install the OpenFusion TCS - JacORB with OpenFusion CORBA Services distribution. This can be obtained from the downloads page by following the OpenFusion CORBA Products software link.
analyst -ORBInitRef NotificationService=file://<OF_INSTALL_DIR>/domains/OpenFusion/localhost/NotificationService/NotificationSingleton/NotificationSingleton.ior
where OF_INSTALL_DIR
is the OpenFusion TCS - JacORB with OpenFusion
CORBA Services installation directory.
The Analyst program will display "Waiting to receive events
", and will
then wait for events to come across the channel.
weatherman -ORBInitRef NotificationService=file://<OF_INSTALL_DIR>/domains/OpenFusion/localhost/NotificationService/NotificationSingleton/NotificationSingleton.ior
where OF_INSTALL_DIR
is the OpenFusion TCS - JacORB with OpenFusion
CORBA Services installation directory.
The WeatherMan program, like the stock market Analyst program, will display
"Waiting to receive events
" and will then
await events from the channel.
stockquote -ORBInitRef NotificationService=file://<OF_INSTALL_DIR>/domains/OpenFusion/localhost/NotificationService/NotificationSingleton/NotificationSingleton.ior
where OF_INSTALL_DIR
is the OpenFusion TCS - JacORB with OpenFusion
CORBA Services installation directory.
The StockQuote program will send 100 stock quotes over the channel. These will be received by the Analyst if they are of sufficiently high priority (>5).
weatherstation -ORBInitRef NotificationService=file://<OF_INSTALL_DIR>/domains/OpenFusion/localhost/NotificationService/NotificationSingleton/NotificationSingleton.ior
where OF_INSTALL_DIR
is the OpenFusion TCS - JacORB with OpenFusion
CORBA Services installation directory.
The WeatherStation will send 100 weather reports over the channel. These will be received by the WeatherMan.