Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Event ¶
type Event struct { // Action is the action being performed by event. // Examples: register_user, new_item_inventory etc. Action string `cql:"action" json:"action"` // CorrelationID can be used to "identify" responses, such as checking // if the response is for some particular request. CorrelationID uuuid.UUID `json:"correlation_id,omitempty"` // AggregateID is the ID of aggregate responsible for consuming event. AggregateID int8 `cql:"aggregate_id" json:"aggregate_id"` // Data is the data contained by event. Data []byte `cql:"data" json:"data"` // Timestamp is the time when the event was generated. Timestamp time.Time `cql:"timestamp" json:"timestamp"` // UserUUID is the UUID of the user who generated the event. UserUUID uuuid.UUID `cql:"user_uuid" json:"user_uuid"` // UUID is the unique-indentifier for event. UUID uuuid.UUID `cql:"uuid" json:"uuid"` // Version is the version for events as processed for aggregate-projection. // This is incremented by the aggregate itself each time it updates its // projection. Version int64 `cql:"version" json:"version"` // Year bucket is the year in which the event was generated. // This is used as the partitioning key. YearBucket int16 `cql:"year_bucket" json:"year_bucket"` }
Event refers to a change in system, and is stored in event-store.
type EventMeta ¶
type EventMeta struct { // AggregateVersion tracks the version to be used // by new events for that aggregate. AggregateVersion int64 `cql:"aggregate_version" json:"aggregate_version"` // AggregateID corresponds to AggregateID in // event-store and ID in aggregate-projection. AggregateID int8 `cql:"aggregate_id" json:"aggregate_id"` // PartitionKey is the partitioning key for events_meta table. PartitionKey int8 `cql:"partition_key" json:"partition_key"` }
EventMeta contains the information about hydrating Aggregate-Projections. The AggregateVersion tracks the version to be used by new events for that aggregate. This difference between the aggregate-projection version and AggregateVersion gives us the versions of the events yet to be applied to the aggregate projection.
type EventStoreQuery ¶ added in v1.2.1
type EventStoreQuery struct { // AggregateID is the id for aggregate whose events are to be fetched AggregateID int8 `json:"aggregate_id"` // AggregateVersion is the highest version of events that have been // already fetched by the aggregate. The event-store will be queried // for events greater than this version. AggregateVersion int64 `json:"aggregate_version"` }
EventStoreQuery can be used to fetch later events than the specified version.
type KafkaResponse ¶
type KafkaResponse struct { // AggregateID is the ID of aggregate the response is for. AggregateID int8 `json:"aggregate_id,omitempty"` // CorrelationID can be used to "identify" responses, such as checking // if the response is for some particular request. CorrelationID uuuid.UUID `json:"correlation_id,omitempty"` // Input is the data that was being processed. // Use this to provide context of whatever data was attempted to be processed. Input []byte `json:"input"` // Error is the error occurred while processing the Input. // Convert errors to strings, this is just an indication that // something went wrong, so we can signal/display-error to end- // user. Blank Error-string means everything was fine. Error string `json:"error"` // Result is the result after an input was processed. // This is some data returned by processing (such as database results) etc. Result []byte `json:"result,omitempty"` // Topic is the topic on which Kafka producer should produce this message. // This field will not be included as part of the response, and is only // for referencing purposes for producer. Topic string `json:"-"` }
KafkaResponse is the response from consuming a Kafka message and operating on it. This can be used to as a "response-back" to indicate if the operation was successful or not.