Skip to content

Commit d9f61fa

Browse files
authored
Merge pull request #24 from liftbridge-io/split_publish
Separate Publish and PublishToSubject endpoints
2 parents 6728b7c + 4ec4f58 commit d9f61fa

File tree

4 files changed

+1080
-258
lines changed

4 files changed

+1080
-258
lines changed

api.proto

Lines changed: 38 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -72,25 +72,42 @@ message FetchMetadataResponse {
7272
repeated StreamMetadata metadata = 2; // Information for all streams
7373
}
7474

75-
// PublishRequest is sent to publish a new message.
75+
// PublishRequest is sent to publish a new message to a stream.
7676
message PublishRequest {
77-
bytes key = 1; // Message key
78-
bytes value = 2; // Message payload
79-
string stream = 3; // Stream name to publish to
80-
int32 partition = 4; // Stream partition to publish to
81-
string subject = 5; // NATS subject to publish to
82-
string replySubject = 6; // NATS reply subject
83-
map<string, bytes> headers = 7; // Message headers
84-
string ackInbox = 8; // NATS subject to publish acks to
85-
string correlationId = 9; // User-supplied value to correlate acks to publishes
86-
AckPolicy ackPolicy = 10; // Controls the behavior of acks
87-
}
88-
89-
// PublishResponse is sent by the server after publishing a message.
77+
bytes key = 1; // Message key
78+
bytes value = 2; // Message payload
79+
string stream = 3; // Stream name to publish to
80+
int32 partition = 4; // Stream partition to publish to
81+
map<string, bytes> headers = 5; // Message headers
82+
string ackInbox = 6; // NATS subject to publish acks to
83+
string correlationId = 7; // User-supplied value to correlate acks to publishes
84+
AckPolicy ackPolicy = 8; // Controls the behavior of acks
85+
}
86+
87+
// PublishResponse is sent by the server after publishing a message to a
88+
// stream.
9089
message PublishResponse {
9190
Ack ack = 1; // The ack for the published message if AckPolicy was not NONE
9291
}
9392

93+
// PublishToSubjectRequest is sent to publish a Liftbridge message to a NATS
94+
// subject.
95+
message PublishToSubjectRequest {
96+
bytes key = 1; // Message key
97+
bytes value = 2; // Message payload
98+
string subject = 3; // NATS subject to publish to
99+
map<string, bytes> headers = 4; // Message headers
100+
string ackInbox = 5; // NATS subject to publish acks to
101+
string correlationId = 6; // User-supplied value to correlate acks to publishes
102+
AckPolicy ackPolicy = 7; // Controls the behavior of acks
103+
}
104+
105+
// PublishToSubjectResponse is sent by the server after publishing a message to
106+
// a NATS subject.
107+
message PublishToSubjectResponse {
108+
Ack ack = 1; // The ack for the published message if AckPolicy was not NONE
109+
}
110+
94111
// Broker contains information for a Liftbridge broker.
95112
message Broker {
96113
string id = 1; // Broker id
@@ -220,9 +237,15 @@ service API {
220237
// broker information.
221238
rpc FetchMetadata(FetchMetadataRequest) returns (FetchMetadataResponse) {}
222239

223-
// Publish a new message to a subject. If the AckPolicy is not NONE and a
240+
// Publish a new message to a stream. If the AckPolicy is not NONE and a
224241
// deadline is provided, this will synchronously block until the ack is
225242
// received. If the ack is not received in time, a DeadlineExceeded status
226243
// code is returned.
227244
rpc Publish(PublishRequest) returns (PublishResponse) {}
245+
246+
// Publish a Liftbridge message to a NATS subject. If the AckPolicy is not NONE and a
247+
// deadline is provided, this will synchronously block until the first ack
248+
// is received. If an ack is not received in time, a DeadlineExceeded
249+
// status code is returned.
250+
rpc PublishToSubject(PublishToSubjectRequest) returns (PublishToSubjectResponse) {}
228251
}

0 commit comments

Comments
 (0)