1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
OVERVIEW
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 COSS Event Service,
though not as sophisticated.
This example also illustrates how to integrate Orbix with the ACE
libraries.
DIRECTORY STRUCTURE
There are 4 directories:
Supplier
-- The supplier test driver, 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
via its standard input.
The Supplier must be registered with the ORB using the
following command:
% putit Event_Comm_Notifier <pathname>/supplier
Consumer
-- The consumer test driver, which must be started
after the Supplier. It has an instance of an
IDL Notification_Receiver object. This object is
used to receive notifications from the Notifier object
residing in the Supplier. When the Consumer starts up it
gets an object reference to the Supplier's Notifier.
It then subscribes its Notification_Receiver object with
the Supplier's Notifier by passing an object reference.
In addition to passing an object reference to a
Notification_Receiver, 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).
The Consumer must be registered with the ORB
using the following command:
% putit Event_Comm_Notification_Receiver <pathname>/consumer
include
-- This contains links to the appropriate header
files.
libsrc
-- This contains the IDL files and IDL implementation
classes that support the distributed notification scheme.
These are shared by the Consumer and Supplier.
RUNNING THE TESTS
To run the tests do the following:
1. Compile everything.
2. Start up the Orbix daemon (orbixd) if it's not already
running.
3. Register the Consumer (i.e., Notification_Receiver) and Supplier
(i.e., Notifier) with the Orbix daemon (orbixd), as described
above.
4. Start the Supplier/supplier executable.
5. Start up as many copies of the Consumer/consumer as you'd like.
Typically, I run each one in its own window. If you'd like to use
different machines make sure that you start up the Orbix daemon on
each one and register the Consumer.
6. 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
Consumer window.
Note that if you type "quit", ^D, or ^C in a Consumer window the
Consumer will unsubscribe and shutdown its handlers and exit.
Likewise, if you type "quit", ^D, or ^C in the Supplier window
the Supplier will disconnect all of its Consumers and exit.
When a Consumer is disconnected from its Supplier it automatically
shuts itself down.
7. When you want to terminate a Consumer or a Supplier, just type ^C
and the process will shut down gracefully.
Please let me know if there are any questions.
Doug
schmidt@cs.wustl.edu
|