dapr-ruby 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +12 -0
- data/.rspec +3 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/.travis.yml +7 -0
- data/CHANGELOG.md +13 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +69 -0
- data/LICENSE.txt +21 -0
- data/README.md +79 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/regen_client.sh +21 -0
- data/bin/setup +8 -0
- data/dapr/proto/common/v1/common.proto +160 -0
- data/dapr/proto/runtime/v1/appcallback.proto +313 -0
- data/dapr/proto/runtime/v1/dapr.proto +1044 -0
- data/dapr.gemspec +46 -0
- data/example.rb +25 -0
- data/examples/app-callback/README.md +25 -0
- data/examples/app-callback/app_callback_example.rb +15 -0
- data/examples/app-callback/app_callback_service.rb +53 -0
- data/examples/invoke-simple/README.md +17 -0
- data/examples/invoke-simple/invoke-caller.rb +19 -0
- data/examples/invoke-simple/invoke-receiver.rb +27 -0
- data/examples/pubsub-simple/README.md +13 -0
- data/examples/pubsub-simple/publisher.rb +19 -0
- data/examples/pubsub-simple/subscriber.rb +32 -0
- data/examples/state-store/README.md +7 -0
- data/examples/state-store/state-store.rb +29 -0
- data/lib/dapr/proto/common/v1/common_pb.rb +90 -0
- data/lib/dapr/proto/runtime/v1/appcallback_pb.rb +139 -0
- data/lib/dapr/proto/runtime/v1/appcallback_services_pb.rb +90 -0
- data/lib/dapr/proto/runtime/v1/dapr_pb.rb +526 -0
- data/lib/dapr/proto/runtime/v1/dapr_services_pb.rb +138 -0
- data/lib/dapr/version.rb +3 -0
- data/lib/dapr-client.rb +3 -0
- data/lib/dapr.rb +1 -0
- metadata +158 -0
@@ -0,0 +1,313 @@
|
|
1
|
+
/*
|
2
|
+
Copyright 2021 The Dapr Authors
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
you may not use this file except in compliance with the License.
|
5
|
+
You may obtain a copy of the License at
|
6
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
7
|
+
Unless required by applicable law or agreed to in writing, software
|
8
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
9
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
10
|
+
See the License for the specific language governing permissions and
|
11
|
+
limitations under the License.
|
12
|
+
*/
|
13
|
+
|
14
|
+
syntax = "proto3";
|
15
|
+
|
16
|
+
package dapr.proto.runtime.v1;
|
17
|
+
|
18
|
+
import "google/protobuf/empty.proto";
|
19
|
+
import "dapr/proto/common/v1/common.proto";
|
20
|
+
import "google/protobuf/struct.proto";
|
21
|
+
|
22
|
+
option csharp_namespace = "Dapr.AppCallback.Autogen.Grpc.v1";
|
23
|
+
option java_outer_classname = "DaprAppCallbackProtos";
|
24
|
+
option java_package = "io.dapr.v1";
|
25
|
+
option go_package = "github.com/dapr/dapr/pkg/proto/runtime/v1;runtime";
|
26
|
+
|
27
|
+
// AppCallback V1 allows user application to interact with Dapr runtime.
|
28
|
+
// User application needs to implement AppCallback service if it needs to
|
29
|
+
// receive message from dapr runtime.
|
30
|
+
service AppCallback {
|
31
|
+
// Invokes service method with InvokeRequest.
|
32
|
+
rpc OnInvoke (common.v1.InvokeRequest) returns (common.v1.InvokeResponse) {}
|
33
|
+
|
34
|
+
// Lists all topics subscribed by this app.
|
35
|
+
rpc ListTopicSubscriptions(google.protobuf.Empty) returns (ListTopicSubscriptionsResponse) {}
|
36
|
+
|
37
|
+
// Subscribes events from Pubsub
|
38
|
+
rpc OnTopicEvent(TopicEventRequest) returns (TopicEventResponse) {}
|
39
|
+
|
40
|
+
// Lists all input bindings subscribed by this app.
|
41
|
+
rpc ListInputBindings(google.protobuf.Empty) returns (ListInputBindingsResponse) {}
|
42
|
+
|
43
|
+
// Listens events from the input bindings
|
44
|
+
//
|
45
|
+
// User application can save the states or send the events to the output
|
46
|
+
// bindings optionally by returning BindingEventResponse.
|
47
|
+
rpc OnBindingEvent(BindingEventRequest) returns (BindingEventResponse) {}
|
48
|
+
}
|
49
|
+
|
50
|
+
// AppCallbackHealthCheck V1 is an optional extension to AppCallback V1 to implement
|
51
|
+
// the HealthCheck method.
|
52
|
+
service AppCallbackHealthCheck {
|
53
|
+
// Health check.
|
54
|
+
rpc HealthCheck(google.protobuf.Empty) returns (HealthCheckResponse) {}
|
55
|
+
}
|
56
|
+
|
57
|
+
// AppCallbackAlpha V1 is an optional extension to AppCallback V1 to opt
|
58
|
+
// for Alpha RPCs.
|
59
|
+
service AppCallbackAlpha {
|
60
|
+
// Subscribes bulk events from Pubsub
|
61
|
+
rpc OnBulkTopicEventAlpha1(TopicEventBulkRequest) returns (TopicEventBulkResponse) {}
|
62
|
+
}
|
63
|
+
|
64
|
+
// TopicEventRequest message is compatible with CloudEvent spec v1.0
|
65
|
+
// https://github.com/cloudevents/spec/blob/v1.0/spec.md
|
66
|
+
message TopicEventRequest {
|
67
|
+
// id identifies the event. Producers MUST ensure that source + id
|
68
|
+
// is unique for each distinct event. If a duplicate event is re-sent
|
69
|
+
// (e.g. due to a network error) it MAY have the same id.
|
70
|
+
string id = 1;
|
71
|
+
|
72
|
+
// source identifies the context in which an event happened.
|
73
|
+
// Often this will include information such as the type of the
|
74
|
+
// event source, the organization publishing the event or the process
|
75
|
+
// that produced the event. The exact syntax and semantics behind
|
76
|
+
// the data encoded in the URI is defined by the event producer.
|
77
|
+
string source = 2;
|
78
|
+
|
79
|
+
// The type of event related to the originating occurrence.
|
80
|
+
string type = 3;
|
81
|
+
|
82
|
+
// The version of the CloudEvents specification.
|
83
|
+
string spec_version = 4;
|
84
|
+
|
85
|
+
// The content type of data value.
|
86
|
+
string data_content_type = 5;
|
87
|
+
|
88
|
+
// The content of the event.
|
89
|
+
bytes data = 7;
|
90
|
+
|
91
|
+
// The pubsub topic which publisher sent to.
|
92
|
+
string topic = 6;
|
93
|
+
|
94
|
+
// The name of the pubsub the publisher sent to.
|
95
|
+
string pubsub_name = 8;
|
96
|
+
|
97
|
+
// The matching path from TopicSubscription/routes (if specified) for this event.
|
98
|
+
// This value is used by OnTopicEvent to "switch" inside the handler.
|
99
|
+
string path = 9;
|
100
|
+
|
101
|
+
// The map of additional custom properties to be sent to the app. These are considered to be cloud event extensions.
|
102
|
+
google.protobuf.Struct extensions = 10;
|
103
|
+
}
|
104
|
+
|
105
|
+
// TopicEventResponse is response from app on published message
|
106
|
+
message TopicEventResponse {
|
107
|
+
// TopicEventResponseStatus allows apps to have finer control over handling of the message.
|
108
|
+
enum TopicEventResponseStatus {
|
109
|
+
// SUCCESS is the default behavior: message is acknowledged and not retried or logged.
|
110
|
+
SUCCESS = 0;
|
111
|
+
// RETRY status signals Dapr to retry the message as part of an expected scenario (no warning is logged).
|
112
|
+
RETRY = 1;
|
113
|
+
// DROP status signals Dapr to drop the message as part of an unexpected scenario (warning is logged).
|
114
|
+
DROP = 2;
|
115
|
+
}
|
116
|
+
|
117
|
+
// The list of output bindings.
|
118
|
+
TopicEventResponseStatus status = 1;
|
119
|
+
}
|
120
|
+
|
121
|
+
// TopicEventCERequest message is compatible with CloudEvent spec v1.0
|
122
|
+
message TopicEventCERequest {
|
123
|
+
// The unique identifier of this cloud event.
|
124
|
+
string id = 1;
|
125
|
+
|
126
|
+
// source identifies the context in which an event happened.
|
127
|
+
string source = 2;
|
128
|
+
|
129
|
+
// The type of event related to the originating occurrence.
|
130
|
+
string type = 3;
|
131
|
+
|
132
|
+
// The version of the CloudEvents specification.
|
133
|
+
string spec_version = 4;
|
134
|
+
|
135
|
+
// The content type of data value.
|
136
|
+
string data_content_type = 5;
|
137
|
+
|
138
|
+
// The content of the event.
|
139
|
+
bytes data = 6;
|
140
|
+
|
141
|
+
// Custom attributes which includes cloud event extensions.
|
142
|
+
google.protobuf.Struct extensions = 7;
|
143
|
+
}
|
144
|
+
|
145
|
+
// TopicEventBulkRequestEntry represents a single message inside a bulk request
|
146
|
+
message TopicEventBulkRequestEntry {
|
147
|
+
// Unique identifier for the message.
|
148
|
+
string entry_id = 1;
|
149
|
+
|
150
|
+
// The content of the event.
|
151
|
+
oneof event {
|
152
|
+
bytes bytes = 2;
|
153
|
+
TopicEventCERequest cloud_event = 3;
|
154
|
+
}
|
155
|
+
|
156
|
+
// content type of the event contained.
|
157
|
+
string content_type = 4;
|
158
|
+
|
159
|
+
// The metadata associated with the event.
|
160
|
+
map<string,string> metadata = 5;
|
161
|
+
}
|
162
|
+
|
163
|
+
// TopicEventBulkRequest represents request for bulk message
|
164
|
+
message TopicEventBulkRequest {
|
165
|
+
// Unique identifier for the bulk request.
|
166
|
+
string id = 1;
|
167
|
+
|
168
|
+
// The list of items inside this bulk request.
|
169
|
+
repeated TopicEventBulkRequestEntry entries = 2;
|
170
|
+
|
171
|
+
// The metadata associated with the this bulk request.
|
172
|
+
map<string,string> metadata = 3;
|
173
|
+
|
174
|
+
// The pubsub topic which publisher sent to.
|
175
|
+
string topic = 4;
|
176
|
+
|
177
|
+
// The name of the pubsub the publisher sent to.
|
178
|
+
string pubsub_name = 5;
|
179
|
+
|
180
|
+
// The type of event related to the originating occurrence.
|
181
|
+
string type = 6;
|
182
|
+
|
183
|
+
// The matching path from TopicSubscription/routes (if specified) for this event.
|
184
|
+
// This value is used by OnTopicEvent to "switch" inside the handler.
|
185
|
+
string path = 7;
|
186
|
+
}
|
187
|
+
|
188
|
+
// TopicEventBulkResponseEntry Represents single response, as part of TopicEventBulkResponse, to be
|
189
|
+
// sent by subscibed App for the corresponding single message during bulk subscribe
|
190
|
+
message TopicEventBulkResponseEntry {
|
191
|
+
// Unique identifier associated the message.
|
192
|
+
string entry_id = 1;
|
193
|
+
|
194
|
+
// The status of the response.
|
195
|
+
TopicEventResponse.TopicEventResponseStatus status = 2;
|
196
|
+
}
|
197
|
+
|
198
|
+
// AppBulkResponse is response from app on published message
|
199
|
+
message TopicEventBulkResponse {
|
200
|
+
|
201
|
+
// The list of all responses for the bulk request.
|
202
|
+
repeated TopicEventBulkResponseEntry statuses = 1;
|
203
|
+
}
|
204
|
+
|
205
|
+
// BindingEventRequest represents input bindings event.
|
206
|
+
message BindingEventRequest {
|
207
|
+
// Required. The name of the input binding component.
|
208
|
+
string name = 1;
|
209
|
+
|
210
|
+
// Required. The payload that the input bindings sent
|
211
|
+
bytes data = 2;
|
212
|
+
|
213
|
+
// The metadata set by the input binging components.
|
214
|
+
map<string,string> metadata = 3;
|
215
|
+
}
|
216
|
+
|
217
|
+
// BindingEventResponse includes operations to save state or
|
218
|
+
// send data to output bindings optionally.
|
219
|
+
message BindingEventResponse {
|
220
|
+
// The name of state store where states are saved.
|
221
|
+
string store_name = 1;
|
222
|
+
|
223
|
+
// The state key values which will be stored in store_name.
|
224
|
+
repeated common.v1.StateItem states = 2;
|
225
|
+
|
226
|
+
// BindingEventConcurrency is the kind of concurrency
|
227
|
+
enum BindingEventConcurrency {
|
228
|
+
// SEQUENTIAL sends data to output bindings specified in "to" sequentially.
|
229
|
+
SEQUENTIAL = 0;
|
230
|
+
// PARALLEL sends data to output bindings specified in "to" in parallel.
|
231
|
+
PARALLEL = 1;
|
232
|
+
}
|
233
|
+
|
234
|
+
// The list of output bindings.
|
235
|
+
repeated string to = 3;
|
236
|
+
|
237
|
+
// The content which will be sent to "to" output bindings.
|
238
|
+
bytes data = 4;
|
239
|
+
|
240
|
+
// The concurrency of output bindings to send data to
|
241
|
+
// "to" output bindings list. The default is SEQUENTIAL.
|
242
|
+
BindingEventConcurrency concurrency = 5;
|
243
|
+
}
|
244
|
+
|
245
|
+
// ListTopicSubscriptionsResponse is the message including the list of the subscribing topics.
|
246
|
+
message ListTopicSubscriptionsResponse {
|
247
|
+
// The list of topics.
|
248
|
+
repeated TopicSubscription subscriptions = 1;
|
249
|
+
}
|
250
|
+
|
251
|
+
// TopicSubscription represents topic and metadata.
|
252
|
+
message TopicSubscription {
|
253
|
+
// Required. The name of the pubsub containing the topic below to subscribe to.
|
254
|
+
string pubsub_name = 1;
|
255
|
+
|
256
|
+
// Required. The name of topic which will be subscribed
|
257
|
+
string topic = 2;
|
258
|
+
|
259
|
+
// The optional properties used for this topic's subscription e.g. session id
|
260
|
+
map<string,string> metadata = 3;
|
261
|
+
|
262
|
+
// The optional routing rules to match against. In the gRPC interface, OnTopicEvent
|
263
|
+
// is still invoked but the matching path is sent in the TopicEventRequest.
|
264
|
+
TopicRoutes routes = 5;
|
265
|
+
|
266
|
+
// The optional dead letter queue for this topic to send events to.
|
267
|
+
string dead_letter_topic = 6;
|
268
|
+
|
269
|
+
// The optional bulk subscribe settings for this topic.
|
270
|
+
BulkSubscribeConfig bulk_subscribe = 7;
|
271
|
+
}
|
272
|
+
|
273
|
+
message TopicRoutes {
|
274
|
+
// The list of rules for this topic.
|
275
|
+
repeated TopicRule rules = 1;
|
276
|
+
|
277
|
+
// The default path for this topic.
|
278
|
+
string default = 2;
|
279
|
+
}
|
280
|
+
|
281
|
+
message TopicRule {
|
282
|
+
// The optional CEL expression used to match the event.
|
283
|
+
// If the match is not specified, then the route is considered
|
284
|
+
// the default.
|
285
|
+
string match = 1;
|
286
|
+
|
287
|
+
// The path used to identify matches for this subscription.
|
288
|
+
// This value is passed in TopicEventRequest and used by OnTopicEvent to "switch"
|
289
|
+
// inside the handler.
|
290
|
+
string path = 2;
|
291
|
+
}
|
292
|
+
|
293
|
+
// BulkSubscribeConfig is the message to pass settings for bulk subscribe
|
294
|
+
message BulkSubscribeConfig {
|
295
|
+
// Required. Flag to enable/disable bulk subscribe
|
296
|
+
bool enabled = 1;
|
297
|
+
|
298
|
+
// Optional. Max number of messages to be sent in a single bulk request
|
299
|
+
int32 max_messages_count = 2;
|
300
|
+
|
301
|
+
// Optional. Max duration to wait for messages to be sent in a single bulk request
|
302
|
+
int32 max_await_duration_ms = 3;
|
303
|
+
}
|
304
|
+
|
305
|
+
// ListInputBindingsResponse is the message including the list of input bindings.
|
306
|
+
message ListInputBindingsResponse {
|
307
|
+
// The list of input bindings.
|
308
|
+
repeated string bindings = 1;
|
309
|
+
}
|
310
|
+
|
311
|
+
// HealthCheckResponse is the message with the response to the health check.
|
312
|
+
// This message is currently empty as used as placeholder.
|
313
|
+
message HealthCheckResponse {}
|