To use the cosNotification application clients must be implemented. There are twelve types of clients:
The interfaces for these participants are defined in CosNotification.idl and CosNotifyComm.idl.
We start by creating an interface which inherits from the correct interface, e.g., CosNotifyComm::SequencePushConsumer. Hence, we must also implement all operations defined in the SequencePushConsumer interface. The IDL-file could look like:
#include
module myClientImpl {
interface ownInterface:CosNotifyComm::SequencePushConsumer {
void ownFunctions(in any NeededArguments)
raises(Systemexceptions,OwnExceptions);
};
};
#endif
]]>
Run the IDL compiler on this file by calling the
The callback module must contain the necessary functions inherited from CosNotification.idl and CosNotifyComm.idl.
Below is a short transcript on how to run cosNotification.
%% Start Mnesia and Orber
mnesia:delete_schema([node()]),
mnesia:create_schema([node()]),
orber:install([node()]),
mnesia:start(),
orber:start(),
%% If cosEvent not installed before it is necessary to do it now.
cosEventApp:install(),
%% Install cosNotification in the IFR.
cosNotificationApp:install(30),
%% Register the application specific Client implementations
%% in the IFR.
'oe_myClientImpl':'oe_register'(),
%% Start the cosNotification application.
cosNotificationApp:start(),
%% Start a factory using the default configuration
ChFac = cosNotificationApp:start_factory(),
%% ... or use configuration parameters.
ChFac = cosNotificationApp:start_factory([]),
%% Create a new event channel. Note, if no QoS- anr/or Admin-properties
%% are supplied (i.e. empty list) the default settings are used.
{Ch, ChID} = 'CosNotifyChannelAdmin_EventChannelFactory':
create_channel(ChFac, DefaultQoS, DefaultAdmin),
%% Retrieve a SupplierAdmin and a Consumer Admin.
{AdminSupplier, ASID}=
'CosNotifyChannelAdmin_EventChannel':new_for_suppliers(Ch, 'OR_OP'),
{AdminConsumer, ACID}=
'CosNotifyChannelAdmin_EventChannel':new_for_consumers(Ch,'OR_OP'),
%% Use the corresponding Admin object to get access to wanted Proxies
%% Create a Push Consumer Proxie, i.e., the Client Push Supplier will
%% push events to this Proxy.
{StructuredProxyPushConsumer,ID11}= 'CosNotifyChannelAdmin_SupplierAdmin':
obtain_notification_push_consumer(AdminSupplier, 'STRUCTURED_EVENT')),
%% Create Push Suppliers Proxies, i.e., the Proxy will push events to the
%% registered Push Consumers.
{ProxyPushSupplier,I4D}='CosNotifyChannelAdmin_ConsumerAdmin':
obtain_notification_push_supplier(AdminConsumer, 'ANY_EVENT'),
{StructuredProxyPushSupplier,ID5}='CosNotifyChannelAdmin_ConsumerAdmin':
obtain_notification_push_supplier(AdminConsumer, 'STRUCTURED_EVENT'),
{SequenceProxyPushSupplier,ID6}='CosNotifyChannelAdmin_ConsumerAdmin':
obtain_notification_push_supplier(AdminConsumer, 'SEQUENCE_EVENT'),
%% Create application Clients. We can, for example, start the Clients
%% our selves or look them up in the naming service. This is application
%% specific.
SupplierClient = ...
ConsumerClient1 = ...
ConsumerClient2 = ...
ConsumerClient3 = ...
%% Connect each Client to corresponding Proxy.
'CosNotifyChannelAdmin_StructuredProxyPushConsumer':
connect_structured_push_supplier(StructuredProxyPushConsumer, SupplierClient),
'CosNotifyChannelAdmin_ProxyPushSupplier':
connect_any_push_consumer(ProxyPushSupplier, ConsumerClient1),
'CosNotifyChannelAdmin_StructuredProxyPushSupplier':
connect_structured_push_consumer(StructuredProxyPushSupplier, ConsumerClient2),
'CosNotifyChannelAdmin_SequenceProxyPushSupplier':
connect_sequence_push_consumer(SequenceProxyPushSupplier, ConsumerClient3),
The example above, exemplifies a notification system where the SupplierClient in some way generates event and pushes them to the proxy. The push supplier proxies will eventually push the events to each ConsumerClient.