Skip to content

Commit

Permalink
Merge pull request #123 from dolittle/batched-event-handler
Browse files Browse the repository at this point in the history
Get fundamentals up for allowing batched event handlers
  • Loading branch information
woksin authored Sep 19, 2022
2 parents 0b6caa6 + 937f602 commit 7c81027
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 5 deletions.
15 changes: 13 additions & 2 deletions Source/Runtime/Events.Processing/EventHandlers.proto
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,25 @@ message HandleEventRequest {
RetryProcessingState retryProcessingState = 3;
}

message HandleEventBatchRequest {
services.ReverseCallRequestContext callContext = 1;
repeated StreamEvent events = 2;
RetryProcessingState retryProcessingState = 3;
}

message EventHandlerRuntimeToClientMessage {
oneof Message {
EventHandlerRegistrationResponse registrationResponse = 1;
HandleEventRequest handleRequest = 2;
HandleEventRequest handleRequest = 2 [deprecated = true]; // Replaced by handleBatchRequest
services.Ping ping = 3;
HandleEventBatchRequest handleBatchRequest = 4;
}
}

service EventHandlers {
rpc Connect(stream EventHandlerClientToRuntimeMessage) returns(stream EventHandlerRuntimeToClientMessage);
rpc Connect(stream EventHandlerClientToRuntimeMessage) returns(stream EventHandlerRuntimeToClientMessage){
option deprecated = true;
}; // Replaced by ConnectBatched
rpc ConnectBatched(stream EventHandlerClientToRuntimeMessage) returns(stream EventHandlerRuntimeToClientMessage);

}
1 change: 1 addition & 0 deletions Source/Runtime/Events.Processing/Processors.proto
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ message ProcessorFailure {
string reason = 1;
bool retry = 2;
google.protobuf.Duration retryTimeout = 3;
StreamEventMetadata eventMetadata = 4; // The metadata of the event that failed
}

message RetryProcessingState {
Expand Down
14 changes: 11 additions & 3 deletions Source/Runtime/Events.Processing/StreamEvent.proto
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,15 @@ option go_package = "go.dolittle.io/contracts/runtime/events/processing";

message StreamEvent {
events.CommittedEvent event = 1;
string partitionId = 2;
protobuf.Uuid scopeId = 3;
bool partitioned = 4;
string partitionId = 2 [deprecated = true]; // Replaced by metadata
protobuf.Uuid scopeId = 3 [deprecated = true]; // Replaced by metadata
bool partitioned = 4 [deprecated = true]; // Replaced by metadata
StreamEventMetadata metadata = 5; // The metadata of the stream event
}

message StreamEventMetadata {
string partitionId = 1; // The partition id of the event
protobuf.Uuid scopeId = 2; // The scope id of the event
bool partitioned = 3; // Whether the stream is partitioned or not
uint64 streamPosition = 4; // The stream position of the event
}

0 comments on commit 7c81027

Please sign in to comment.