All Downloads are FREE. Search and download functionalities are using the official Maven repository.

kalix.tck.model.eventing.local_persistence_eventing.proto Maven / Gradle / Ivy

// Copyright 2022 Lightbend Inc.

//
// == Kalix TCK model test for Event Sourced Entity eventing ==
// see tck/src/main/scala/com/kalix/tck/EventingTCK.scala

syntax = "proto3";

package kalix.tck.model.eventing;

import "google/protobuf/any.proto";
import "google/protobuf/empty.proto";
import "kalix/annotations.proto";

option go_package = "github.com/lightbend/kalix-go-sdk/tck/eventing;eventing";
option java_package = "kalix.tck.model.eventing";

//
// The `LocalPersistenceSubscriberModel` service is an Action that should be implemented in the following ways:
//
// - The `ProcessEventOne` method receives an `EventOne` message, and must behave according to the passed in step.
// - The `ProcessEventTwo` method receives an `EventTwo` message, and must return a stream of responses, one for each
//   incoming step.
// - The `ProcessAnyEvent` method receives a `google.protobuf.Any`, which will contain JSON serialized according to
//   the Kalix JSON serialization conventions, with a `type_url` of `json.kalix.io/JsonEvent`. The contents
//   of the JSON message will be a JSON object with a single message property, and the call must respond with this
//   message in the `Response`.
// - The `ProcessValueOne` method receives an `ValueOne` message, and must behave according to the passed in step.
// - The `ProcessValueTwo` method receives an `ValueTwo` message, and must return a stream of responses, one for each
//   incoming step.
// - The `ProcessAnyValue` method receives a `google.protobuf.Any`, which will contain JSON serialized according to
//   the Kalix JSON serialization conventions, with a `type_url` of `json.kalix.io/JsonValue`. The
//   contents of the JSON message will be a JSON object with a single message property, and the call must respond with
//   this message in the `Response`.
// - The `Effect` method receives an `EffectRequest` message and must respond with a `Response` that contains the id
//   from the effect message.
// - Forwarding and side effects should be made to the `Effect` call.
// - The response to the Process calls, or the effects and forwards emitted by them, must contain the message field
//   from the incoming events, along with the id read from the CloudEvent metadata source property.
//
service LocalPersistenceSubscriberModel {
  rpc ProcessEventOne(EventOne) returns (Response) {
    option (kalix.method).eventing.in = {event_sourced_entity: "eventlogeventing-one"};
  }
  rpc ProcessEventTwo(EventTwo) returns (stream Response) {
    option (kalix.method).eventing.in = {event_sourced_entity: "eventlogeventing-one"};
  }
  rpc ProcessAnyEvent(google.protobuf.Any) returns (Response) {
    option (kalix.method).eventing.in = {event_sourced_entity: "eventlogeventing-two"};
  }
  rpc ProcessValueOne(ValueOne) returns (Response) {
    option (kalix.method).eventing.in = {value_entity: "valuechangeseventing-one"};
  }
  rpc ProcessValueTwo(ValueTwo) returns (stream Response) {
    option (kalix.method).eventing.in = {value_entity: "valuechangeseventing-one"};
  }
  rpc ProcessAnyValue(google.protobuf.Any) returns (Response) {
    option (kalix.method).eventing.in = {value_entity: "valuechangeseventing-two"};
  }
  rpc Effect(EffectRequest) returns (Response);
}

//
// The `EventSourcedEntityOne` service is an event sourced entity that should be implemented in the following ways:
//
// - The `EmitEvent` method should emit the event in the `EmitEventRequest` method as a protobuf serialized event.
// - The persistence id for it must be `eventlogeventing-one`.
//
service EventSourcedEntityOne {
  rpc EmitEvent(EmitEventRequest) returns (google.protobuf.Empty);
}

//
// The `EventSourcedEntityTwo` service is an event sourced entity that should be implemented in the following ways:
//
// - The `EmitJsonEvent` method should emit an event serialised as JSON. This event should:
//   - Contain a single `message` property with the value of the `message` field in `JsonEvent`.
//   - Be serialized according to the Kalix JSON serialization conventions - that is, with the JSON serialized
//     to bytes, then placed into a protobuf message with a single bytes field with field number 1.
//   - Have a type_url of `json.kalix.io/JsonEvent`.
// - The persistence id for it must be `eventlogeventing-two`.
//
service EventSourcedEntityTwo {
  rpc EmitJsonEvent(JsonEvent) returns (google.protobuf.Empty);
}

//
// An `EmitEventRequest` is received by the `EventSourcedEntityOne` entity to instruct it to emit either an `EventOne`
// or an `EventTwo`.
//
message EmitEventRequest {
  string id = 1 [(kalix.field).entity_key = true];
  oneof event {
    EventOne event_one = 2;
    EventTwo event_two = 3;
  }
}

//
// An `EventOne` is an event emitted by the `EventSourcedEntityOne` entity and subscribed to by
// `LocalPersistenceSubscriberModel`.
//
message EventOne {
  ProcessStep step = 2;
}

//
// An `EventTwo` is an event emitted by the `EventSourcedEntityOne` entity and subscribed to by
// `LocalPersistenceSubscriberModel`.
//
message EventTwo {
  repeated ProcessStep step = 2;
}

//
// A `JsonEvent` is an event emitted by the `EventSourcedEntityTwo` entity and subscribed to by
// `LocalPersistenceSubscriberModel`.
//
message JsonEvent {
  string id = 1 [(kalix.field).entity_key = true];
  string message = 2;
}

//
// The `ValueEntityOne` service is an value entity that should be implemented in the following ways:
//
// - The `UpdateValue` method should update the value to the value in `UpdateValueRequest` method as a protobuf
//   serialized event.
// - The persistence id for it must be `valuechangeseventing-one`.
//
service ValueEntityOne {
  rpc UpdateValue(UpdateValueRequest) returns (google.protobuf.Empty);
}

//
// The `ValueEntityTwo` service is a value entity that should be implemented in the following ways:
//
// - The `UpdateJsonValue` method should update a value to be serialised as JSON. This value should:
//   - Contain a single `message` property with the value of the `message` field in `JsonValue`.
//   - Be serialized according to the Kalix JSON serialization conventions - that is, with the JSON serialized to
//     bytes, then placed into a protobuf message with a single bytes field with field number 1.
//   - Have a type_url of `json.kalix.io/JsonValue`.
// - The persistence id for it must be `valuechangeseventing-two`.
//
service ValueEntityTwo {
  rpc UpdateJsonValue(JsonValue) returns (google.protobuf.Empty);
}

//
// An `UpdateValueRequest` is received by the `ValueEntityOne` entity to instruct it to emit either an `ValueOne`
// or an `ValueTwo`.
//
message UpdateValueRequest {
  string id = 1 [(kalix.field).entity_key = true];
  oneof value {
    ValueOne value_one = 2;
    ValueTwo value_two = 3;
  }
}

//
// An `ValueOne` is an value persisted by the `ValueEntityOne` entity and subscribed to by
// `ValueChangesSubscriberModel`.
//
message ValueOne {
  ProcessStep step = 2;
}

//
// An `ValueTwo` is an event persisted by the `ValueEntityOne` entity and subscribed to by
// `ValueChangesSubscriberModel`.
//
message ValueTwo {
  repeated ProcessStep step = 2;
}

//
// A `JsonValue` is a value persisted by the `ValueEntityTwo` entity and subscribed to by
// `ValueChangesSubscriberModel`.
//
message JsonValue {
  string id = 1 [(kalix.field).entity_key = true];
  string message = 2;
}

//
// Each `ProcessStep` is one of:
//
// - Reply: reply with the given message in a `Response`.
// - Forward: forward to another service, in place of replying with a `Response`.
//
message ProcessStep {
  oneof step {
    Reply reply = 1;
    Forward forward = 2;
  }
}

//
// Reply with a message in the response.
//
message Reply {
  string message = 1;
}

//
// Replace the response with a forward to `kalix.tck.model.localpersistenceeventing.LocalPersistenceSubscriberModel/Effect`.
// The payload must be an `EffectRequest` message with the given `message`.
//
message Forward {
  string message = 1;
}

//
// The `Response` message must contain the message from the corresponding reply step.
//
message Response {
  string id = 1;
  string message = 2;
}

// The `EffectRequest` message must contain the id from the SideEffect or Forward.
message EffectRequest {
  string id = 1;
  string message = 2;
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy