messages

package
v4.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 1, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Status = struct {
	Queued, Succeeded, Failed, Done string
}{
	Queued:    "queued",
	Succeeded: "succeeded",
	Failed:    "failed",
	Done:      "done",
}
View Source
var Type = struct {
	Event, Command, Query, Response string
}{
	Event:    "event",
	Command:  "command",
	Query:    "query",
	Response: "response",
}

Functions

func New

func New[T ~Message](key Key, attributes, meta any) *T

func Random added in v4.8.0

func Random[T ~Message]() *T

func RandomAttributes added in v4.8.0

func RandomAttributes(attributes any)

func RandomWithAttributes added in v4.8.0

func RandomWithAttributes[T ~Message](attributes any, shouldRandomize bool) *T

func RandomWithKey added in v4.8.0

func RandomWithKey[T ~Message](key Key) *T

Types

type Key added in v4.8.0

type Key string

func NewKey added in v4.8.0

func NewKey(key *KeyComponents) Key

type KeyComponents added in v4.8.0

type KeyComponents struct {
	Organization, Service, Version, Type, Entity, Event, Command, Query, Response, Status string
}

Terminology:

  • Organization = Context
  • Service = Module
  • Entity = Aggregate/Root

Nomenclature of a Key:

  • organization.service.version.type.entity.event/command/query/response.status
  • codexgo.user.1.event.user.created.succeeded

type Message

type Message = struct {
	ID         string
	OccurredOn string
	Key        Key
	Attributes any
	Meta       any
}

type Recipient added in v4.8.0

type Recipient string

func NewRecipient added in v4.8.0

func NewRecipient(recipient *RecipientComponents) Recipient

type RecipientComponents added in v4.8.0

type RecipientComponents struct {
	Service, Entity, Action, Event, Command, Status string
}

Terminology:

  • Service = Module
  • Entity = Aggregate/Root

Nomenclature of a Recipient:

  • service.entity.action_on_event/command_status
  • user.user.send_confirmation_on_created_succeeded

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL