Event data is propagated through the Event Service system in the form of the IDL type any. The any type is a container for either built-in or user-defined IDL data types, and further holds a TypeCode that acts as a run-time identifier of the prevailing data type. Dynamic run-time type safety is however sacrificed for static compile-type safety and any type mismatch escapes undetected at compile time. The possibility of such an occurrence is however greatly minimized through usage, under the auspicies of type any, of a single user-defined type that encapsulates a sequence of `slow control objects'. Thus, by design, all data propagated through the event channels of different domains, is of the same type, leading to a less complex and more robust transmission medium. Since event filtering is not part of the Event Service specification, network traffic is minimized by connecting a single supplier to a given event channel; clients interested in events from multiple sources thus register with multiple event channels. The use of event channels to handle event deliveries relieves the clients from the communication details and the need to establish callbacks. Table 3 shows how a push consumer is implemented in Tcl. The fact that the client is required to register as an event consumer is a consequence of the many event delivery models (i.e. push, pull, push/pull, pull/push.)
|
class Consumer_impl { |
inherit CosEventComm::PushConsumer |
public method Consumer_impl { } |
public method push { data } { |
Invoke Tcl procedure to display data |
DisplayEventData $data |
} |
public method disconnect_push_consumer { |
Action on disconnect |
} |
} |
Instantiate Consumer class |
set Consumer [Consumer_impl #auto ] |
Activate Consumer class |
$poa activate_object $Consumer |
$mgr activate |
Register as event channel consumer |
set name {{ "SLS:Bd:EventChannel" kind " "}} |
Resolve event channel |
set CosEventCh [$obj resolve $name] |
set CosAdmin [$CosEventCh for_consumers] |
set Supplier [$CosAdmin obtain_push_supplier] |
$Supplier connect_push_consumer [$Consumer _this] |