» Content »pkg://ace_6.0.3.orig.tar.bz2:15358417
/ info downloads
This directory contains source code for a prototype CORBA-based
distributed notification mechanism. This mechanism implements a
"publish/subscribe" communication protocol. It allows Suppliers to
pass messages containing object references to a dynamically managed
group of Consumers. This is similar to the OMG COS Events Service,
though not as sophisticated. For more examples on the COS Events
Service check out $TAO_ROOT/orbsvcs/orbsvcs/.
There are 3 executables:
-- The Notifier supplies events from Suppliers to Consumers
It which must be started first.
It has an instance of an IDL Notifier
object. This object accepts subscriptions from Consumers
and forwards events sent to it either via Consumers or
The Notifier object is registered with a naming service
so that it can be located by other objects.
To run the Notifier, type:
To exit the Notifier press CTRL-C.
All consumers registered with the Notifier will shutdown.
Suppliers should however, be shutdown beforehand.
On startup the Supplier gets hold of the Notifier object from
the naming service and registers itself with it.
The Supplier accepts strings from the user and sends them to
To run the supplier type:
To exit the supplier type CTRL-C or type "quit".
To send strings to the Consumers, type the string on the prompt
and press ENTER.
It has an instance of an IDL Consumer object.
This object is used to receive notifications from the
When the Consumer starts up, it gets an object reference to
It then subscribes its Consumer object with
the Notifier by passing an object reference.
In addition to passing an object reference to a
Notifier, the Consumer also may specify a
filtering criteria, which is a regular expression. If
the filtering criteria is the string "" then the Notifier
will send all Notifications to the Consumer (i.e., "" is
treated as a "wildcard"). Otherwise, the filtering
criteria is considered to be a regular expression,
and only those Notification tags that match the regular
expression will be forwarded to the Consumer. The regular
expressions are those used by ed(1) (see the regexp(5)
manual page for more info).
To run the Consumer, type:
e.g. consumer a*b
will accept the following strings: ab , b, aaaab.
To send strings to other Consumers, type the string on the prompt
and press ENTER.
RUNNING THE SAMPLE:
To run the tests do the following:
1. Compile everything.
2. Start the Notifier as described above.
3. Start the Supplier executable.
4. Start up as many copies of the Consumer as you'd like.
Typically, I run each one in its own window.
5. Once the Consumers have subscribed you can send them info by typing
commands in the Supplier window. These will be sent to all the
Consumers who have subscribed. Likewise, you can send messages
from a Consumer to all other Consumers by typing messages in a
Note that if you type "quit" or ^C in a Consumer window the
Consumer will unsubscribe and shutdown its handlers and exit.
Likewise, if you type ^C in the Notifier window
the Notifier will disconnect all of its Consumers and exit.
6. When you want to terminate a Consumer or a Supplier, just type ^C
or "quit" and the process will shut down gracefully.