syntax = "proto3"; package io.axoniq.axonserver.grpc.event; import "common.proto"; option java_multiple_files = true; /* Service providing operations against the EventStore functionality of Axon Server */ service EventStore { // Accepts a stream of Events returning a Confirmation when completed. rpc AppendEvent (stream Event) returns (Confirmation) { } // Accepts a Snapshot event returning a Confirmation when completed. rpc AppendSnapshot (Event) returns (Confirmation) { } // Retrieves the Events for a given aggregate. Results are streamed rather than returned at once. rpc ListAggregateEvents (GetAggregateEventsRequest) returns (stream Event) { } // Retrieves the Snapshots for a given aggregate. Results are streamed rather than returned at once. rpc ListAggregateSnapshots (GetAggregateSnapshotsRequest) returns (stream Event) { } /* Retrieves the Events from a given tracking token. However, if several GetEventsRequests are sent in the stream only first one will create the tracker, others are used for increasing number of permits or blacklisting. Results are streamed rather than returned at once. */ rpc ListEvents (stream GetEventsRequest) returns (stream EventWithToken) { } // Gets the highest sequence number for a specific aggregate. rpc ReadHighestSequenceNr (ReadHighestSequenceNrRequest) returns (ReadHighestSequenceNrResponse) { } // Performs a query on the event store, returns a stream of results. Input is a stream to allow flow control from the // client rpc QueryEvents (stream QueryEventsRequest) returns (stream QueryEventsResponse) { } // Retrieves the first token available in event store (typically 0). Returns 0 when no events in store. rpc GetFirstToken (GetFirstTokenRequest) returns (TrackingToken) { } // Retrieves the last committed token in event store. Returns -1 when no events in store. rpc GetLastToken (GetLastTokenRequest) returns (TrackingToken) { } // Retrieves the token of the first token of an event from specified time in event store. Returns -1 when no events in store. rpc GetTokenAt (GetTokenAtRequest) returns (TrackingToken) { } } /* Service to use AxonServer as a provider of an EventScheduler */ service EventScheduler { // Schedule the given event for publication at the given time}. The returned ScheduleToken can be used to cancel the planned publication. rpc ScheduleEvent (ScheduleEventRequest) returns (ScheduleToken) { } // Cancel a scheduled event and schedule another in its place. rpc RescheduleEvent (RescheduleEventRequest) returns (ScheduleToken) { } // Cancel the publication of a scheduled event. If the events has already been published, this method does nothing. rpc CancelScheduledEvent (CancelScheduledEventRequest) returns (common.InstructionAck) { } } /* Request message to schedule an event */ message ScheduleEventRequest { /* timestamp when to publish the event */ int64 instant = 1; /* the event to publish */ Event event = 2; } /* Request message to reschedule an event */ message RescheduleEventRequest { /* optional token of scheduled event to cancel */ string token = 1; /* timestamp when to publish the event */ int64 instant = 2; /* the event to publish */ Event event = 3; } /* Request message to cancel an event */ message CancelScheduledEventRequest { /* token of scheduled event to cancel */ string token = 1; } /* Token to manage a scheduled event */ message ScheduleToken { /* Field defining the token identifier */ string token = 1; } /* Request message to receive the first Token (Tail Token) of the Event Stream */ message GetFirstTokenRequest { } /* Request message to receive the last Token (Head Token) of the Event Stream */ message GetLastTokenRequest { } /* Request message to receive the Token that starts streaming events from the given timestamp */ message GetTokenAtRequest { /* Timestamp expressed as milliseconds since epoch */ int64 instant = 1; } /* Message containing the information necessary to track the position of events in the Event Stream */ message TrackingToken { /* The value of the Token */ int64 token = 1; } /* Message wrapping an Event and a Tracking Token */ message EventWithToken { /* The Token representing the position of this Event in the Stream */ int64 token = 1; /* The actual Event Message */ Event event = 2; } /* Message providing the parameters for executing a Query against AxonServer. */ message QueryEventsRequest { /* The query to execute against the Event Stream */ string query = 1; /* The number of results AxonServer may send before new permits need to be provided */ int64 number_of_permits = 2; /* Whether to keep the query running against incoming events once the Head of the Stream is reached */ bool live_events = 3; /* Indicates whether to force querying events from the leader node of an Axon Server. Forcing reads from leader * reduces the staleness of the data read, but also puts extra burden on the leader, reducing overall scalability. *

* This property has no effect on connections to AxonServer SE. *

*/ bool force_read_from_leader = 4; } /* A message describing a response to a Query request */ message QueryEventsResponse { /* The actual contents of this response */ oneof data { /* Provided when the response contains the names of the columns the response contains. This message typically arrives first. */ ColumnsResponse columns = 1; /* Provided when the response message contains results of the Query */ RowResponse row = 2; /* Provided when all historic events have been included in the query results */ Confirmation files_completed = 3; } } /* Message containing the names of the columns returned in a Query */ message ColumnsResponse { /* The names of the columns provided in the query */ repeated string column = 1; } /* Message providing Query Result data */ message RowResponse { /* The values which, when combined, uniquely update this row. Any previously received values with the same identifiers should be replaced with this value */ repeated QueryValue id_values = 1; /* The sorting values to use when sorting this response compared to the others. */ repeated QueryValue sort_values = 2; /* The actual data values for each of the columns, as a column name -> value mapping */ map values = 3; } /* Describes the combination of an Aggregate Identifier and first expected Sequence number when opening an Aggregate-specific Event Stream */ message ReadHighestSequenceNrRequest { /* The Identifier of the Aggregate for which to load events */ string aggregate_id = 1; /* The Sequence Number of the first event expected */ int64 from_sequence_nr = 3; } /* The highest Sequence Number found for the provided request*/ message ReadHighestSequenceNrResponse { /* The sequence number of the latest event */ int64 to_sequence_nr = 1; } /* A confirmation to a request from the client */ message Confirmation { /* True when successful, otherwise false */ bool success = 1; } /* Request describing the desire to read events for a specific Aggregate */ message GetAggregateEventsRequest { /* The identifier of the aggregate to read events for */ string aggregate_id = 1; /* The sequence number of the first event to receive */ int64 initial_sequence = 2; /* Whether a snapshot may be returned as first element in the stream */ bool allow_snapshots = 3; /* The maximum sequence number (inclusive) of the events to retrieve, 0 means up to last event */ int64 max_sequence = 4; /* Hint for a minimum token to search events from */ int64 min_token = 5; } /* Request message to retrieve Snapshot Events for a specific Aggregate instance */ message GetAggregateSnapshotsRequest { /* The identifier to fetch the snapshots for */ string aggregate_id = 1; /* The minimal sequence number of the snapshots to retrieve */ int64 initial_sequence = 2; /* The maximum sequence number of the snapshots to retrieve */ int64 max_sequence = 3; /* The maximum number of results to stream */ int32 max_results = 4; } /* Request message to open an Event Stream from the Event Store. */ message GetEventsRequest { /* The token to start streaming from */ int64 tracking_token = 1; /* The number of messages the server may send before it needs to wait for more permits */ int64 number_of_permits = 2; /* The unique identifier of this client instance. Used for monitoring. */ string client_id = 3; /* The component name of this client instance. Used for monitoring. */ string component_name = 4; /* The name of the processor requesting this stream. Used for monitoring. */ string processor = 5; /* An enumeration of payload types that need to be blacklisted. The Server will stop sending messages of these types in order to reduce I/O. Note that the Server may occasionally send a blacklisted message to prevent time-outs and stale tokens on clients. */ repeated PayloadDescription blacklist = 6; /* Indicates whether to force reading events from the leader node of an Axon Server. Forcing reads from leader * reduces the staleness of the data read, but also puts extra burden on the leader, reducing overall scalability. *

* This property has no effect on connections to AxonServer SE. *

*/ bool force_read_from_leader = 7; } /* Message containing the information of an Event */ message Event { /* The unique identifier of this event */ string message_identifier = 1; /* The identifier of the Aggregate instance that published this event, if any */ string aggregate_identifier = 2; /* The sequence number of the Event in the Aggregate instance that published it, if any */ int64 aggregate_sequence_number = 3; /* The Type of the Aggregate instance that published this Event, if any */ string aggregate_type = 4; /* The timestamp of the Event */ int64 timestamp = 5; /* The Payload of the Event */ common.SerializedObject payload = 6; /* The Meta Data of the Event */ map meta_data = 7; /* Flag indicating whether the Event is a snapshot Event */ bool snapshot = 8; } /* Value used in Query Responses to represent a value in its original type */ message QueryValue { /* The actual value, which can be one of string, 64 bit signed integer, boolean or 64 bits floating point */ oneof data { /* The text value */ string text_value = 1; /* The (64 bits) integer value */ sint64 number_value = 2; /* The boolean value */ bool boolean_value = 3; /* The (64 bits) floating point value */ double double_value = 4; } } /* Description of a Payload Type */ message PayloadDescription { /* The type identifier of the Payload */ string type = 1; /* The revision of the Payload Type */ string revision = 2; }