19972016
Ericsson AB. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Event Service
97-11-19
A
ch_es_intro.xml
Overview of the CosEvent Service
The Event service allows programmers to subscribe to
information channels. Suppliers can generate events without knowing the
consumer identities and the consumer can receive events without knowing
the supplier identity. Both push and pull event delivery are supported.
The Event service will queue information and processes.
The CORBA Event service provides a flexible model for
asynchronous, decoupled communication between objects. This
chapter outlines communication models and the roles and
relationships of key components in the CosEvent service. It
shows a simple example on use of this service.
Event Service Components
There are five components in the OMG CosEvent service architecture. These
are described below:
Figure 1: Event service Components
- Suppliers and consumers: Consumers are the ultimate targets of
events generated by suppliers. Consumers and suppliers can both play active
and
passive roles. There could be two types of consumers and suppliers: push
or pull. A PushSupplier object can actively push an event to a passive
PushConsumer object. Likewise, a PullSupplier object can passively
wait for a PullConsumer object to actively pull an event from it.
- EventChannel: The central abstraction in the CosEvent service is the
EventChannel which plays the role of a mediator between consumers and
suppliers. Consumers and suppliers register their interest with the
EventChannel. It can provide many-to-many communication. The channel
consumes events from one or more suppliers, and supplies events to one
or more consumers. An EventChannel can support consumers and suppliers
using different communication models.
- ProxySuppliers and ProxyConsumers: ProxySuppliers act as middlemen
between consumers and the EventChannel. A ProxySupplier is similar to
a normal supplier, but includes an additional method for connecting a
consumer to the ProxySupplier. Likewise, ProxyConsumers act as
middlemen between suppliers and the EventChannel. A ProxyConsumer is
similar to a normal consumer, but includes an additional method for
connecting a supplier to the ProxyConsumer.
- Supplier and consumer administrations: Consumer administration acts as
a factory for creating ProxySuppliers. Supplier administration acts as
a factory for creating ProxyConsumers.
Event Service Communication Models
There are four general models of component collaboration in the OMG CosEvent service
architecture. The following describes these models:
(Please note that proxies are not shown in the diagrams for simplicity).
Figure 2: Event service Communication Models
- The Canonical Push Model: The Canonical push model shown in figure 2(A) allows
the suppliers of events to initiate the transfer of event data to consumers.
In this model, suppliers are active initiators and consumers are the passive
targets of the requests. EventChannels play the role of .
Thus, active suppliers use EventChannels to push data to passive consumers that
have registered with the EventChannels.
- The Canonical Pull Model:The Canonical pull model shown
in figure 2(B)
allows consumers to request events from suppliers. In this model,
Consumers are
active initiators and suppliers are the passive targets of the pull
requests.
EventChannel plays the role of since it procures
events
on behalf of consumers. Thus, active consumers can explicitly pull
data
from passive suppliers via the EventChannels.
- The Hybrid Push/Pull Model: The push/pull model shown in figure 2(C) is a
hybrid that allows consumers to request events queued at an EventChannel
by suppliers. In this model, both suppliers and consumers are active
initiators of the requests. EventChannels play the role of .
Thus, active consumers can explicitly pull data deposited by active
suppliers via the EventChannels.
- The Hybrid Pull/Push Model: The pull/push model shown in figure 2(D) is another
hybrid that allows the channel to pull events from suppliers and push them
to consumers. In this model, suppliers are passive targets of pull requests
and consumers are passive targets of pushes. EventChannels play the role of
. Thus, active EventChannels can pull data from
passive suppliers and push that data to passive consumers.
A Tutorial on How to Create a Simple Service
To be able to use the cosEvent application supplier and consumer objects
must be implemented, which must inherit from the appropriate interface
defined in the CosEventComm.idl specification.
We start by creating an interface which inherits from the correct interface,
e.g., CosEventComm::PushConsumer. Hence, we must also implement all
operations defined in the PushConsumer interface. The IDL-file could look like:
module myClientImpl {
interface ownInterface:CosEventComm::PushConsumer {
void ownFunctions(in any NeededArguments)
raises(OwnExceptions);
};
};
#endif
]]>
Run the IDL compiler on this file by calling the function.
This will produce the API named .
After generating the API stubs and the server skeletons it is time to
implement the servers and if no special options are sent
to the IDl compiler the file name is .
How to Run Everything
Below is a short transcript on how to run cosEvent.
The example above, exemplifies a event system, i.e., the Canonical Push Model, where the Supplier client in some way generates event
and pushes them to the proxy. The push supplier proxies will eventually
push the events to each Consumer client.