-
Notifications
You must be signed in to change notification settings - Fork 173
/
appcallback.proto
95 lines (72 loc) · 3.18 KB
/
appcallback.proto
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
syntax = "proto3";
package spec.proto.runtime.v1;
import "google/protobuf/empty.proto";
option go_package = "mosn.io/layotto/spec/proto/runtime/v1;runtime";
option java_outer_classname = "AppCallbackProto";
option java_package = "spec.proto.runtime.v1";
/* @exclude skip quickstart_generator */
// AppCallback V1 allows user application to interact with runtime.
// User application needs to implement AppCallback service if it needs to
// receive message from runtime.
service AppCallback {
// Lists all topics subscribed by this app.
rpc ListTopicSubscriptions(google.protobuf.Empty) returns (ListTopicSubscriptionsResponse) {}
// Subscribes events from Pubsub
rpc OnTopicEvent(TopicEventRequest) returns (TopicEventResponse) {}
}
// TopicEventRequest message is compatible with CloudEvent spec v1.0
// https://github.com/cloudevents/spec/blob/v1.0/spec.md
message TopicEventRequest {
// id identifies the event. Producers MUST ensure that source + id
// is unique for each distinct event. If a duplicate event is re-sent
// (e.g. due to a network error) it MAY have the same id.
string id = 1;
// source identifies the context in which an event happened.
// Often this will include information such as the type of the
// event source, the organization publishing the event or the process
// that produced the event. The exact syntax and semantics behind
// the data encoded in the URI is defined by the event producer.
string source = 2;
// The type of event related to the originating occurrence.
string type = 3;
// The version of the CloudEvents specification.
string spec_version = 4;
// The content type of data value.
string data_content_type = 5;
// The content of the event.
bytes data = 7;
// The pubsub topic which publisher sent to.
string topic = 6;
// The name of the pubsub the publisher sent to.
string pubsub_name = 8;
// add a map to pass some extra properties.
map<string,string> metadata = 10;
}
// TopicEventResponse is response from app on published message
message TopicEventResponse {
// TopicEventResponseStatus allows apps to have finer control over handling of the message.
enum TopicEventResponseStatus {
// SUCCESS is the default behavior: message is acknowledged and not retried or logged.
SUCCESS = 0;
// RETRY status signals runtime to retry the message as part of an expected scenario (no warning is logged).
RETRY = 1;
// DROP status signals runtime to drop the message as part of an unexpected scenario (warning is logged).
DROP = 2;
}
// The list of output bindings.
TopicEventResponseStatus status = 1;
}
// ListTopicSubscriptionsResponse is the message including the list of the subscribing topics.
message ListTopicSubscriptionsResponse {
// The list of topics.
repeated TopicSubscription subscriptions = 1;
}
// TopicSubscription represents topic and metadata.
message TopicSubscription {
// Required. The name of the pubsub containing the topic below to subscribe to.
string pubsub_name = 1;
// Required. The name of topic which will be subscribed
string topic = 2;
// The optional properties used for this topic's subscription e.g. session id
map<string,string> metadata = 3;
}