summaryrefslogtreecommitdiff
path: root/TAO/docs/notification/using_monitor_extensions.html
blob: 324fb63cc08dfcecc2234ffd5d5815fc58cec670 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
  <title>Using the CosNotification Monitoring Extensions</title>
  <!-- $Id$ -->
</head>
<body>
<h2>Using the NotifyMonitoringExt::EventChannelFactory.</h2>
<p>
Obtain the CosNotification Service EventChannelFactory from the Name Service
as you normally would.  Instead of narrowing it to a
<b>CosNotifyChannelAdmin::EventChannelFactory</b>, narrow it to a
<b>NotifyMonitoringExt::EventChannelFactory</b>.
</p>
<pre>
  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());
</pre>
<p>
You can then create named event channels using the
<b>create_named_channel</b> method.
</p>
<pre>
  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");
</pre>
<h2>Using the NotifyMonitoringExt::ConsumerAdmin.</h2>
<p>
Obtain the <b>NotifyMonitoringExt::ConsumerAdmin</b> as you would the
<b>CosNotifyChannelAdmin::ConsumerAdmin</b>.  However, it must then be
narrowed to a <b>NotifyMonitoringExt::ConsumerAdmin</b>.
</p>
<pre>
  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());
</pre>
<p>
It is also possible to create named ConsumerAdmin objects using the
following.
</p>
<pre>
  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());
</pre>
<p>
Once you have a <b>NotifyMonitoringExt::ConsumerAdmin</b> you can then
create a named proxy push supplier:
</p>
<pre>
  CosNotifyChannelAdmin::ProxyID proxy_id;

  CosNotifyChannelAdmin::ProxySupplier_var proxy_supplier =
    admin->obtain_named_notification_push_supplier (
                    CosNotifyChannelAdmin::STRUCTURED_EVENT,
                    proxy_id,
                    "Consumer Name");
</pre>
<h2>Using the NotifyMonitoringExt::SupplierAdmin.</h2>
<p>
Obtain the <b>NotifyMonitoringExt::SupplierAdmin</b> as you would the
<b>CosNotifyChannelAdmin::SupplierAdmin</b>.  However, it must then be
narrowed to a <b>NotifyMonitoringExt::SupplierAdmin</b>.
</p>
<pre>
  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());
</pre>
<p>
It is also possible to create named ConsumerAdmin objects using the
following.
</p>
<pre>
  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());
</pre>
<p>
Once you have a <b>NotifyMonitoringExt::SupplierAdmin</b> you can then
create a named proxy push consumer:
</p>
<pre>
  CosNotifyChannelAdmin::ProxyID proxy_id;

  CosNotifyChannelAdmin::ProxyConsumer_var proxy_consumer =
    admin->obtain_named_notification_push_consumer (
                    CosNotifyChannelAdmin::STRUCTURED_EVENT,
                    proxy_id,
                    "Supplier Name");
</pre>
<h2>Effects of using these interfaces</h2>
<p>
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.
</p>
<font size=-1>See also the <a href="monitor.html">Notification Service
Monitor</a> documentation.</font>
</body>
</html>