From ad538d46cbf285ba5b425da7e6a9d1cec2f86e6d Mon Sep 17 00:00:00 2001 From: Arsene Tochemey Gandote Date: Fri, 11 Jun 2021 16:57:02 +0000 Subject: [PATCH 1/2] readside streaming --- chief_of_state/v1/readside.proto | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/chief_of_state/v1/readside.proto b/chief_of_state/v1/readside.proto index 9f88851..50af181 100644 --- a/chief_of_state/v1/readside.proto +++ b/chief_of_state/v1/readside.proto @@ -16,8 +16,10 @@ import "google/protobuf/any.proto"; // ChiefOfState will connect to this service when the readSide is enabled and // push events to it. service ReadSideHandlerService { - // Helps build a read model from persisted events and snpahots - rpc HandleReadSide(HandleReadSideRequest) returns (HandleReadSideResponse); + // Helps build a read model from persisted events and snapshots + rpc HandleReadSide(HandleReadSideRequest) returns (HandleReadSideResponse){} + // Send a sequence of events and snapshots to be processed to build a read model. + rpc HandleReadSideStream (stream HandleReadSideRequest) returns (HandleReadSideResponse){} } // ReadSideRequest is used to push the ReadSideHandler From 570fb7c1935dcf2153383f13fb7b533e1aaadf02 Mon Sep 17 00:00:00 2001 From: Arsene Tochemey Gandote Date: Fri, 11 Jun 2021 17:18:43 +0000 Subject: [PATCH 2/2] checkin --- chief_of_state/v1/readside.proto | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/chief_of_state/v1/readside.proto b/chief_of_state/v1/readside.proto index 50af181..d049462 100644 --- a/chief_of_state/v1/readside.proto +++ b/chief_of_state/v1/readside.proto @@ -19,10 +19,10 @@ service ReadSideHandlerService { // Helps build a read model from persisted events and snapshots rpc HandleReadSide(HandleReadSideRequest) returns (HandleReadSideResponse){} // Send a sequence of events and snapshots to be processed to build a read model. - rpc HandleReadSideStream (stream HandleReadSideRequest) returns (HandleReadSideResponse){} + rpc HandleReadSideStream (stream HandleReadSideStreamRequest) returns (HandleReadSideStreamResponse){} } -// ReadSideRequest is used to push the ReadSideHandler +// HandleReadSideRequest is used to push the ReadSideHandler // events and state persisted in the journal and the snapshot message HandleReadSideRequest { // the persisted event @@ -35,10 +35,32 @@ message HandleReadSideRequest { string read_side_id = 4; } -// ReadSideResponse is used by ChiefOfState to either +// HandleReadSideResponses is used by ChiefOfState to either // commit events read offset or not. message HandleReadSideResponse { // successful=true means the offset will be committed and the readside will move on to process the next event. // Otherwise, if successful=false, the event will get reprocessed with a backoff strategy. bool successful = 1; } + + +// HandleReadSideStreamRequest is used to push the ReadSideHandler +// events and state persisted in the journal and the snapshot +message HandleReadSideStreamRequest { + // the persisted event + google.protobuf.Any event = 1; + // the resulting state associated to the persisted event + google.protobuf.Any state = 2; + // additional meta data + chief_of_state.v1.MetaData meta = 3; + // the identifier of the read side service receiving the request + string read_side_id = 4; +} + +// HandleReadSideStreamResponse is used by ChiefOfState to either +// commit events read offset or not. +message HandleReadSideStreamResponse { + // successful=true means the offset will be committed and the readside will move on to process the next event. + // Otherwise, if successful=false, the event will get reprocessed with a backoff strategy. + bool successful = 1; +}