Documentation ¶
Index ¶
- func DeleteState(nc *nats.Conn, opts *AggregateOptions, key string) error
- func NewCloudEvent(eventType string, entityKey string, rawData interface{}) cloudevents.Event
- func StoreState(nc *nats.Conn, opts *AggregateOptions, key string, state AggregateState) error
- type Aggregate
- type AggregateBehavior
- type AggregateMiddleware
- type AggregateOptions
- type AggregateProcess
- type AggregateState
- type Command
- type CommandReply
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeleteState ¶
func DeleteState(nc *nats.Conn, opts *AggregateOptions, key string) error
func NewCloudEvent ¶
func NewCloudEvent(eventType string, entityKey string, rawData interface{}) cloudevents.Event
func StoreState ¶
func StoreState(nc *nats.Conn, opts *AggregateOptions, key string, state AggregateState) error
Types ¶
type Aggregate ¶
type Aggregate struct {
ergonats.PullConsumer
}
func (*Aggregate) HandleMessage ¶
func (*Aggregate) InitPullConsumer ¶
func (a *Aggregate) InitPullConsumer( process *ergonats.PullConsumerProcess, args ...etf.Term) (*ergonats.PullConsumerOptions, error)
type AggregateBehavior ¶
type AggregateBehavior interface { ergonats.PullConsumerBehavior InitAggregate(process *AggregateProcess, args ...etf.Term) (AggregateOptions, error) ApplyEvent(process *AggregateProcess, state AggregateState, event cloudevents.Event) (*AggregateState, error) HandleCommand(process *AggregateProcess, state AggregateState, cmd Command) ([]cloudevents.Event, error) }
type AggregateMiddleware ¶
type AggregateMiddleware interface {
ExecMiddleware(*AggregateState, *Command) error
}
type AggregateOptions ¶
type AggregateOptions struct { Logger *slog.Logger Connection *nats.Conn JsDomain string ServiceVersion string CommandSubjectPrefix string EventSubjectPrefix string StreamName string AcceptedCommands []string StateStoreBucketName string StateStoreMaxValueSize int StateStoreMaxBytes int AggregateName string Middleware []AggregateMiddleware }
type AggregateProcess ¶
type AggregateProcess struct { ergonats.PullConsumerProcess // contains filtered or unexported fields }
type AggregateState ¶
type AggregateState struct { Version uint64 `json:"version"` Key string `json:"key"` Data json.RawMessage `json:"data,omitempty"` }
func LoadState ¶
func LoadState(nc *nats.Conn, opts *AggregateOptions, key string) (*AggregateState, error)
type CommandReply ¶
Click to show internal directories.
Click to hide internal directories.