User's Guide
Reference Manual
Release Notes
PDF
Top

cosEventDomain
User's Guide
Version 1.1.13

Expand All
Contract All

Chapters

# 4 Event Domain Service

### 4.1 Overview of the CosEventDomain Service

The Event Domain service allows programmers to manage a cluster of information channels.

#### Event Domain Service Components

There are two components in the OMG CosEventDomainAdmin service architecture:

- EventDomainFactory: a factory for creating EventDomains.
- EventDomain: supplies a tool, which makes it easy to create topologies of interconnected channels (i.e. a directed graph).

#### A Tutorial on How to Create a Simple Service

To be able to use the cosEventDomain application, the cosNotification and, possibly, the cosTime application must be installed.

#### How to Run Everything

Below is a short transcript on how to run cosEventDomain.

    %% Start Mnesia and Orber
    mnesia:delete_schema([node()]),
    mnesia:create_schema([node()]),
    orber:install([node()]),
    mnesia:start(),
    orber:start(),

    %% Install and start cosNotification.
    cosNotificationApp:install(),
    cosNotificationApp:start(),

    %% Install and start cosEventDomain.
    cosEventDomainApp:install(),
    cosEventDomainApp:start(),

    %% Start a CosEventDomainAdmin factory.
    AdminFac = cosEventDomainApp:start_factory(),

    %% Define the desired QoS settings:
    QoS =
       [#'CosNotification_Property'
        {name='CosEventDomainAdmin':'DiamondDetection'(),
         value=any:create(orber_tc:short(),
         'CosEventDomainAdmin':'AuthorizeDiamonds'())},
        #'CosNotification_Property'
        {name='CosEventDomainAdmin':'CycleDetection'(),
         value=any:create(orber_tc:short(),
         'CosEventDomainAdmin':'ForbidCycles'())}],

    %% Create a new EventDomain:
    {ED, EDId} = 'CosEventDomainAdmin_EventDomainFactory':
                            create_event_domain(Fac, QoS, []),

    %% Now we can add Notification Channels to the Domain. How this
    %% is done, see the cosNotification documentation. Let us assume
    %% that we have gained access to two Channel Objects; add them to the
    %% domain:
    ID1 = 'CosEventDomainAdmin_EventDomain':add_channel(ED, Ch1),
    ID2 = 'CosEventDomainAdmin_EventDomain':add_channel(ED, Ch2),

    %% To connect them, we must first define a connection struct:
    C1 = #'CosEventDomainAdmin_Connection'{supplier_id=ID1,
                                           consumer_id=ID2,
                                           ctype='STRUCTURED_EVENT',
                                           notification_style='Pull'},

    %% Connect them:
    'CosEventDomainAdmin_EventDomain':add_connection(ED, C1),