Obtain the CosNotification Service EventChannelFactory from the Name Service as you normally would. Instead of narrowing it to a CosNotifyChannelAdmin::EventChannelFactory, narrow it to a NotifyMonitoringExt::EventChannelFactory.
CosNaming::Name name(1); name.length(1); name[0].id = CORBA::string_dup("NotifyEventChannelFactory"); CORBA::Object_var obj = naming_context->resolve(name); NotifyMonitoringExt::EventChannelFactory_var notify_factory = NotifyMonitoringExt::EventChannelFactory::_narrow(obj.in());
You can then create named event channels using the create_named_channel method.
CosNotification::QoSProperties initial_qos; CosNotification::AdminProperties initial_admin; CosNotifyChannelAdmin::ChannelID id; CosNotifyChannelAdmin::EventChannel_var ec = notify_factory->create_named_channel(initial_qos, initial_admin, id, "Name of Event Channel");
Obtain the NotifyMonitoringExt::ConsumerAdmin as you would the CosNotifyChannelAdmin::ConsumerAdmin. However, it must then be narrowed to a NotifyMonitoringExt::ConsumerAdmin.
CosNotifyChannelAdmin::AdminID admin_id; CosNotifyChannelAdmin::ConsumerAdmin_var admin = ec->new_for_consumers(CosNotifyChannelAdmin::OR_OP, admin_id); NotifyMonitoringExt::ConsumerAdmin_var madmin = NotifyMonitoringExt::ConsumerAdmin::_narrow(admin.in());
It is also possible to create named ConsumerAdmin objects using the following.
CosNotifyChannelAdmin::AdminID admin_id; CosNotifyChannelAdmin::ConsumerAdmin_var admin = ec->named_new_for_consumers(CosNotifyChannelAdmin::OR_OP, admin_id, "ConsumerAdmin Name"); NotifyMonitoringExt::ConsumerAdmin_var madmin = NotifyMonitoringExt::ConsumerAdmin::_narrow(admin.in());
Once you have a NotifyMonitoringExt::ConsumerAdmin you can then create a named proxy push supplier:
CosNotifyChannelAdmin::ProxyID proxy_id; CosNotifyChannelAdmin::ProxySupplier_var proxy_supplier = admin->obtain_named_notification_push_supplier ( CosNotifyChannelAdmin::STRUCTURED_EVENT, proxy_id, "Consumer Name");
Obtain the NotifyMonitoringExt::SupplierAdmin as you would the CosNotifyChannelAdmin::SupplierAdmin. However, it must then be narrowed to a NotifyMonitoringExt::SupplierAdmin.
CosNotifyChannelAdmin::AdminID admin_id; CosNotifyChannelAdmin::SupplierAdmin_var admin = ec->new_for_suppliers(CosNotifyChannelAdmin::AND_OP, admin_id); NotifyMonitoringExt::SupplierAdmin_var madmin = NotifyMonitoringExt::SupplierAdmin::_narrow(admin.in());
It is also possible to create named ConsumerAdmin objects using the following.
CosNotifyChannelAdmin::AdminID admin_id; CosNotifyChannelAdmin::SupplierAdmin_var admin = ec->named_new_for_suppliers(CosNotifyChannelAdmin::AND_OP, admin_id, "SupplierAdmin Name"); NotifyMonitoringExt::SupplierAdmin_var madmin = NotifyMonitoringExt::SupplierAdmin::_narrow(admin.in());
Once you have a NotifyMonitoringExt::SupplierAdmin you can then create a named proxy push consumer:
CosNotifyChannelAdmin::ProxyID proxy_id; CosNotifyChannelAdmin::ProxyConsumer_var proxy_consumer = admin->obtain_named_notification_push_consumer ( CosNotifyChannelAdmin::STRUCTURED_EVENT, proxy_id, "Supplier Name");
Using these extended interfaces allows users to link descriptive names to various objects held within the CosNotification Service. Assuming that the Notify_Service has been configured to enable the monitoring capabilities, these objects would normally be given names that are equivalent to their id upon activation.
See also the Notification Service Monitor documentation.