messages

package
v4.6.0 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2024 License: MIT Imports: 4 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 string
}{
	Event:   "event",
	Command: "command",
}

Functions

func HasNoQueue

func HasNoQueue(queues []Queue, queue *Queue) bool

func NewRecipientName

func NewRecipientName(components *RecipientNameComponents) string

func NewRoutingKey

func NewRoutingKey(components *RoutingKeyComponents) string

Types

type Attributes

type Attributes = []byte

type BindingKeys

type BindingKeys = []string

type Broker

type Broker interface {
	AddRouter(*Router) error
	AddQueue(*Queue) error
	AddQueueMessageBind(*Queue, BindingKeys) error
	AddQueueConsumer(Consumer) error
	PublishMessages([]*Message) error
}

type Consumer

type Consumer interface {
	SubscribedTo() []*Queue
	On(*Message) error
}

type Message

type Message struct {
	Id, Type, OccurredOn string
	Attributes, Meta     []byte
}

func New

func New(routingKey string, attributes, meta []byte) *Message

type Meta

type Meta = []byte

type Queue

type Queue struct {
	Name     string
	Bindings BindingKeys
}

type RecipientNameComponents

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

Terminology:

  • Service = Module
  • Entity = Aggregate/Root

Nomenclature of a Recipient Name:

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

type Router

type Router struct {
	Name string
}

type RoutingKeyComponents

type RoutingKeyComponents struct {
	Organization, Service, Version, Type, Entity, Event, Command, Status string
}

Terminology:

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

Nomenclature of a Routing Key (Topic):

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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