summaryrefslogtreecommitdiff
path: root/cpp/src/IceStorm/Instrumentation.ice
blob: 2c488805b54fd06224e49e4e14086035eb0eaa21 (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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
// **********************************************************************
//
// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
//
// This copy of Ice is licensed to you under the terms described in the
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************

#pragma once

[["ice-prefix", "cpp:header-ext:h"]]

#include <Ice/Instrumentation.ice>
#include <IceStorm/IceStorm.ice>

module IceStorm
{

module Instrumentation
{

local interface TopicObserver extends Ice::Instrumentation::Observer
{
    /**
     *
     * Notification of an event published on the topic by a publisher.
     *
     **/
    void published();

    /**
     *
     * Notification of an event forwared on the topic by another topic.
     *
     **/
    void forwarded();
};

local interface SubscriberObserver extends Ice::Instrumentation::Observer
{
    /**
     *
     * Notification of some events being queued.
     *
     **/
    void queued(int count);

    /**
     *
     * Notification of a some events being sent.
     *
     **/
    void outstanding(int count);

    /**
     *
     * Notification of some events being delivered.
     *
     **/
    void delivered(int count);
};

/**
 *
 * The ObserverUpdater interface is implemented by IceStorm and an
 * instance of this interface is provided on initialization to the
 * TopicManagerObserver object.
 *
 * This interface can be used by add-ins imlementing the
 * TopicManagerObserver interface to update the obsevers of observed
 * objects.
 *
 **/
local interface ObserverUpdater
{
    /**
     *
     * Update topic observers associated with each topics. 
     *
     * When called, this method goes through all the topics and for
     * each topic TopicManagerObserver::getTopicObserver is
     * called. The implementation of getTopicObserver has the
     * possibility to return an updated observer if necessary.
     * 
     **/
    void updateTopicObservers();

    /**
     *
     * Update subscriber observers associated with each subscriber.
     *
     * When called, this method goes through all the subscribers and
     * for each subscriber TopicManagerObserver::getSubscriberObserver
     * is called. The implementation of getSubscriberObserver has the
     * possibility to return an updated observer if necessary.
     * 
     **/
    void updateSubscriberObservers();
};

enum SubscriberState
{
    /**
     *
     * Online waiting to send events.
     *
     **/
    SubscriberStateOnline,

    /**
     *
     * Offline, retrying.
     *
     **/
    SubscriberStateOffline,

    /**
     *
     * Error state, awaiting to be destroyed.
     *
     **/
    SubscriberStateError
};

/**
 *
 * The topic manager observer interface used by the Ice run-time to
 * obtain and update observers for its observeable objects. This
 * interface should be implemented by add-ins that wish to observe
 * IceStorm objects in order to collect statistics.
 *
 **/
local interface TopicManagerObserver
{
    /**
     *
     * This method should return an observer for the given topic.
     *
     * @param svc The service name.
     *
     * @param name The topic name.
     *
     * @param old The previous observer, only set when updating an
     * existing observer.
     *
     **/
    TopicObserver getTopicObserver(string svc, string name, TopicObserver old);

    /**
     *
     * This method should return an observer for the given subscriber.
     *
     * @param topic The name of the topic subscribed.
     *
     * @param subscriber The proxy of the subscriber.
     *
     * @param qos The QoS configured for the subscriber.
     *
     * @param link The proxy of the linked topic if this subscriber
     * forwards events to a linked topic.
     *
     * @param old The previous observer, only set when updating an
     * existing observer.
     *
     **/
    SubscriberObserver getSubscriberObserver(string svc, string topic, Object* prx, QoS q, IceStorm::Topic* link,
                                             SubscriberState s, SubscriberObserver old);

    /**
     *
     * IceStorm calls this method on initialization. The add-in
     * implementing this interface can use this object to get IceStorm
     * to re-obtain observers for topics and subscribers.
     *
     * @param updater The observer updater object.
     *
     **/
    void setObserverUpdater(ObserverUpdater updater);
};

};
    
};