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

kalix.tck.model.valueentity.value_entity.proto Maven / Gradle / Ivy

// Copyright 2022 Lightbend Inc.

//
// == Kalix TCK model test for value-based entities ==
// see tck/src/main/scala/com/kalix/tck/EntityTCK.scala

syntax = "proto3";

package kalix.tck.model.valueentity;

import "google/api/annotations.proto";
import "kalix/annotations.proto";

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

//
// The `ValueEntityTckModel` service should be implemented in the following ways:
//
// - The entity persistence-id must be `value-entity-tck-model`.
// - The state of the entity is simply a string.
// - The state string values is wrapped in `Persisted` messages.
// - The command handler must set the state to the value of a `Persisted` message.
// - The `Process` method receives a `Request` message with actions to take.
// - Request actions must be processed in order, and can require: updating state, deleting state, forwarding, side
//   effects, or failing.
// - The `Process` method must reply with the state in a `Response`, after taking actions, unless forwarding or failing.
// - Forwarding and side effects must always be made to the second service `ValueEntityTwo`.
//
service ValueEntityTckModel {
  rpc Process(Request) returns (Response) {
    option (google.api.http) = {
      post: "/tck/model/entity/{id}"
      body: "*"
    };
  }
}

//
// The `ValueBasedTwo` service is only for verifying forward actions and side effects.
//
// - The entity persistence-id must be `value-entity-tck-model-two`.
// - The `Call` method is not required to do anything, and must return an empty `Response` message.
//
service ValueEntityTwo {
  rpc Call(Request) returns (Response);
}

//
// The `ValueEntityConfigured` service is for testing entity configuration from the language support:
//
// - The entity persistence-id must be `value-entity-configured`.
// - The `Call` method is not required to do anything, and must return an empty `Response` message.
//
service ValueEntityConfigured {
  rpc Call(Request) returns (Response);
}

//
// A `Request` message contains any actions that the entity should process.
// Actions must be processed in order. Any actions after a `Fail` may be ignored.
//
message Request {
  string id = 1 [(kalix.field).entity_key = true];
  repeated RequestAction actions = 2;
}

//
// Each `RequestAction` is one of:
//
// - Update: update the state, with a given value.
// - Delete: delete the state.
// - Forward: forward to another service, in place of replying with a Response.
// - Effect: add a side effect to another service to the reply.
// - Fail: fail the current `Process` command.
//
message RequestAction {
  oneof action {
    Update update = 1;
    Delete delete = 2;
    Forward forward = 3;
    Effect effect = 4;
    Fail fail = 5;
  }
}

//
// Update the state, with the state value in a `Persisted` message.
//
message Update {
  string value = 1;
}

//
// Delete an the state with a `Persisted` message.
//
message Delete {}

//
// Replace the response with a forward to `kalix.tck.model.valueentity.ValueEntityTwo/Call`.
// The payload must be a `Request` message with the given `id`.
//
message Forward {
  string id = 1;
}

//
// Add a side effect to the reply, to `kalix.tck.model.valueentity.ValueEntityTwo/Call`.
// The payload must be a `Request` message with the given `id`.
// The side effect should be marked synchronous based on the given `synchronous` value.
//
message Effect {
  string id = 1;
  bool synchronous = 2;
}

//
// Fail the current command with the given description `message`.
//
message Fail {
  string message = 1;
}

//
// The `Response` message for the `Process` must contain the current state (after processing actions).
//
message Response {
  string message = 1;
}

//
// The `Persisted` message wraps both state value.
//
message Persisted {
  string value = 1;
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy