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* 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