Ice 3.8
Slice API Reference
Loading...
Searching...
No Matches
IceStorm.ice
1// Copyright (c) ZeroC, Inc.
2
3#pragma once
4
5[["cpp:dll-export:ICESTORM_API"]]
6[["cpp:doxygen:include:IceStorm/IceStorm.h"]]
7[["cpp:header-ext:h"]]
8
9[["cpp:include:IceStorm/Config.h"]]
10
11[["js:module:@zeroc/ice"]]
12
13#include "Ice/Identity.ice"
14#include "Metrics.ice"
15
16/// Lightweight publish/subscribe framework, available for all Ice language mappings.
17["java:identifier:com.zeroc.IceStorm"]
19{
20 interface Topic;
21
22 /// Information about a topic link.
23 struct LinkInfo
24 {
25 /// The linked topic proxy. This proxy is never null.
27
28 /// The name of the linked topic.
29 string name;
30
31 /// The cost of traversing this link.
32 int cost;
33 }
34
35 /// A sequence of {@link LinkInfo} objects.
36 sequence<LinkInfo> LinkInfoSeq;
37
38 /// Quality of service parameters.
39 /// @see Topic#subscribeAndGetPublisher
40 dictionary<string, string> QoS;
41
42 /// The exception that is thrown when attempting to create a link that already exists.
43 exception LinkExists
44 {
45 /// The name of the linked topic.
46 string name;
47 }
48
49 /// The exception that is thrown when attempting to remove a link that does not exist.
50 exception NoSuchLink
51 {
52 /// The name of the link that does not exist.
53 string name;
54 }
55
56 /// The exception that is thrown when attempting to subscribe a proxy for which a subscription already exists.
58 {
59 }
60
61 /// The exception that is thrown when attempting to subscribe with an invalid {@link QoS}.
62 exception BadQoS
63 {
64 /// The reason for the failure.
65 string reason;
66 }
67
68 /// Represents an IceStorm topic. Publishers publish data to a topic (via the topic's publisher object), and
69 /// subscribers subscribe to a topic.
70 /// @see TopicManager
71 interface Topic
72 {
73 /// Gets the name of this topic.
74 /// @return The name of the topic.
75 /// @see TopicManager#create
76 ["cpp:const"]
77 idempotent string getName();
78
79 /// Gets a proxy to a publisher object for this topic. To publish data to a topic, a publisher calls this
80 /// operation and then creates a proxy with the publisher type from this proxy. If a replicated IceStorm
81 /// deployment is used, this call may return a replicated proxy.
82 /// @return A proxy to publish data on this topic. This proxy is never null.
83 ["cpp:const"]
84 idempotent Object* getPublisher();
85
86 /// Gets a non-replicated proxy to a publisher object for this topic. To publish data to a topic, a publisher
87 /// calls this operation and then creates a proxy with the publisher type from this proxy.
88 /// @return A proxy to publish data on this topic. This proxy is never null.
89 ["cpp:const"]
90 idempotent Object* getNonReplicatedPublisher();
91
92 /// Subscribes to this topic.
93 /// @param theQoS The quality of service parameters for this subscription.
94 /// @param subscriber The subscriber's proxy. This proxy cannot be null.
95 /// @return The per-subscriber publisher proxy. This proxy is never null.
96 /// @throws AlreadySubscribed Thrown when @p subscriber is already subscribed.
97 /// @throws BadQoS Thrown when @p theQoS is unavailable or invalid.
98 /// @see #unsubscribe
99 Object* subscribeAndGetPublisher(QoS theQoS, Object* subscriber)
101
102 /// Unsubscribes the provided @p subscriber from this topic.
103 /// @param subscriber A proxy to an existing subscriber. This proxy is never null.
104 /// @see #subscribeAndGetPublisher
105 idempotent void unsubscribe(Object* subscriber);
106
107 /// Creates a link to another topic. All events originating on this topic will also be sent to the other topic.
108 /// @param linkTo The topic to link to. This proxy cannot be null.
109 /// @param cost The cost of the link.
110 /// @throws LinkExists Thrown when a link to @p linkTo already exists.
111 void link(Topic* linkTo, int cost) throws LinkExists;
112
113 /// Destroys a link from this topic to the provided topic.
114 /// @param linkTo The topic to destroy the link to. This proxy cannot be null.
115 /// @throws NoSuchLink Thrown when a link to @p linkTo does not exist.
116 void unlink(Topic* linkTo) throws NoSuchLink;
117
118 /// Gets information on the current links.
119 /// @return A sequence of LinkInfo objects.
120 ["cpp:const"]
122
123 /// Gets the list of subscribers for this topic.
124 /// @return The sequence of Ice identities for the subscriber objects.
126
127 /// Destroys this topic.
128 void destroy();
129 }
130
131 /// A dictionary of topic name to topic proxy.
132 dictionary<string, Topic*> TopicDict;
133
134 /// The exception that is thrown when attempting to create a topic that already exists.
135 exception TopicExists
136 {
137 /// The name of the topic that already exists.
138 string name;
139 }
140
141 /// The exception that is thrown when attempting to retrieve a topic that does not exist.
142 exception NoSuchTopic
143 {
144 /// The name of the topic that does not exist.
145 string name;
146 }
147
148 /// Represents an object that manages topics.
149 /// @see Topic
150 interface TopicManager
151 {
152 /// Creates a new topic.
153 /// @param name The name of the topic.
154 /// @return A proxy to the new topic object. The returned proxy is never null.
155 /// @throws TopicExists Thrown when a topic with the same @p name already exists.
156 Topic* create(string name) throws TopicExists;
157
158 /// Retrieves a topic by name.
159 /// @param name The name of the topic.
160 /// @return A proxy to the topic object. The returned proxy is never null.
161 /// @throws NoSuchTopic Thrown when there is no topic named @p name.
162 idempotent Topic* retrieve(string name) throws NoSuchTopic;
163
164 /// Retrieves all topics managed by this topic manager.
165 /// @return A dictionary of string, topic proxy pairs.
166 idempotent TopicDict retrieveAll();
167 }
168
169 /// Provides access to a {@link TopicManager} object via a fixed identity.
170 /// An IceStorm Finder is always registered with identity `IceStorm/Finder`. This allows clients to obtain the
171 /// associated TopicManager proxy with just the endpoint information of the object. For example, you can use the
172 /// Finder proxy `IceStorm/Finder:tcp -h somehost -p 4061` to get the TopicManager proxy
173 /// `MyIceStorm/TopicManager:tcp -h somehost -p 4061`.
174 interface Finder
175 {
176 /// Gets a proxy to the associated {@link TopicManager}. The proxy might point to several replicas.
177 /// @return The topic manager proxy. This proxy is never null.
179 }
180}
The exception that is thrown when attempting to subscribe a proxy for which a subscription already ex...
Definition IceStorm.ice:58
string reason
The reason for the failure.
Definition IceStorm.ice:65
The exception that is thrown when attempting to subscribe with an invalid QoS.
Definition IceStorm.ice:63
string name
The name of the linked topic.
Definition IceStorm.ice:46
The exception that is thrown when attempting to create a link that already exists.
Definition IceStorm.ice:44
string name
The name of the topic that does not exist.
Definition IceStorm.ice:145
The exception that is thrown when attempting to retrieve a topic that does not exist.
Definition IceStorm.ice:143
string name
The name of the topic that already exists.
Definition IceStorm.ice:138
The exception that is thrown when attempting to create a topic that already exists.
Definition IceStorm.ice:136
TopicManager * getTopicManager()
Gets a proxy to the associated TopicManager.
Provides access to a TopicManager object via a fixed identity.
Definition IceStorm.ice:175
idempotent TopicDict retrieveAll()
Retrieves all topics managed by this topic manager.
idempotent Topic * retrieve(string name)
Retrieves a topic by name.
Topic * create(string name)
Creates a new topic.
Represents an object that manages topics.
Definition IceStorm.ice:151
idempotent LinkInfoSeq getLinkInfoSeq()
Gets information on the current links.
idempotent Object * getPublisher()
Gets a proxy to a publisher object for this topic.
Ice::IdentitySeq getSubscribers()
Gets the list of subscribers for this topic.
void link(Topic *linkTo, int cost)
Creates a link to another topic.
idempotent string getName()
Gets the name of this topic.
idempotent void unsubscribe(Object *subscriber)
Unsubscribes the provided subscriber from this topic.
idempotent Object * getNonReplicatedPublisher()
Gets a non-replicated proxy to a publisher object for this topic.
void unlink(Topic *linkTo)
Destroys a link from this topic to the provided topic.
Object * subscribeAndGetPublisher(QoS theQoS, Object *subscriber)
Subscribes to this topic.
Represents an IceStorm topic.
Definition IceStorm.ice:72
void destroy()
Destroys this topic.
dictionary< string, Topic > TopicDict
A dictionary of topic name to topic proxy.
Definition IceStorm.ice:132
sequence< LinkInfo > LinkInfoSeq
A sequence of LinkInfo objects.
Definition IceStorm.ice:36
dictionary< string, string > QoS
Quality of service parameters.
Definition IceStorm.ice:40
Lightweight publish/subscribe framework, available for all Ice language mappings.
Definition IceStorm.ice:19
sequence< Identity > IdentitySeq
A sequence of identities.
Definition Identity.ice:35
Topic * theTopic
The linked topic proxy. This proxy is never null.
Definition IceStorm.ice:26
string name
The name of the linked topic.
Definition IceStorm.ice:29
int cost
The cost of traversing this link.
Definition IceStorm.ice:32
Information about a topic link.
Definition IceStorm.ice:24