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
syntax = "proto3";
package mqbridge;
service Bridge {
// Publishes a message to the bridge
rpc Publish (BridgeMessage) returns (PublishResponse);
// Publishes a batch of messages using a client stream
rpc PublishBatch (stream BridgeMessage) returns (stream PublishResponse);
// Subscribes to a stream of messages from the bridge
rpc Subscribe (SubscribeRequest) returns (stream BridgeMessage);
// Consumer -> Broker: explicit ack/nack for received messages
rpc Acknowledge (Ack) returns (AckResponse);
}
message BridgeMessage {
bytes payload = 1;
string id = 2;
map<string, string> metadata = 3;
}
message PublishResponse {
// Reserve low field numbers that were used previously to avoid
// accidental wire-compatibility breakage if older clients/servers
// used those numbers for different semantics.
reserved 1, 2, 3;
oneof result {
BridgeMessage reply = 10;
Ack ack = 11;
string error = 12;
}
}
message Ack {
string id = 1;
enum Status {
// Ack by default - this is already the name of the message
ACK = 0;
NACK = 1;
REQUEUE = 2;
}
Status status = 2;
string reason = 3;
map<string, string> metadata = 4;
}
message AckResponse {
bool success = 1;
string error = 2;
}
message SubscribeRequest {
string topic = 1;
}