messages

package
v2.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2023 License: GPL-2.0 Imports: 2 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContentType

type ContentType string

func (ContentType) String

func (c ContentType) String() string

type Message

type Message struct {
	Id          string            `json:"id"`
	Source      string            `json:"source"`
	Subject     string            `json:"subject"`
	SpecVersion string            `json:"specVersion"`
	ContentType ContentType       `json:"contentType"`
	Error       string            `json:"error"`
	Body        []byte            `json:"body"`
	Header      map[string]string `json:"header"`
	Type        MessageType       `json:"type"`
	Time        time.Time         `json:"time"`
}

* A Message is the payload transmitted over the axon wire, it represents detailed information about the communication, likely followed by the body. In the case of an error, body may be nil. It has the following properties:

Id - the unique identifier for this message

Source - the service this message is coming from Subject - the service's topic this message is coming from

SpecVersion - the version specification of this message

ContentType - the content type of the body []byte so it can be decoded appropriately using the proper encoder/decoder Body - the actual payload for use internal your application Time - when this message was created

func NewMessage

func NewMessage() *Message

func (*Message) WithBody

func (e *Message) WithBody(body []byte) *Message

func (*Message) WithContentType

func (e *Message) WithContentType(contentType ContentType) *Message

func (*Message) WithId

func (e *Message) WithId(id string) *Message

func (*Message) WithSource

func (e *Message) WithSource(source string) *Message

func (*Message) WithSpecVersion

func (e *Message) WithSpecVersion(version string) *Message

func (*Message) WithSubject

func (e *Message) WithSubject(subject string) *Message

func (*Message) WithTime

func (e *Message) WithTime(t time.Time) *Message

func (*Message) WithType

func (e *Message) WithType(t MessageType) *Message

type MessageType

type MessageType int
const (
	ErrorMessage MessageType = iota
	RequestMessage
	ResponseMessage
	EventMessage
)

func (MessageType) String

func (d MessageType) String() string

Jump to

Keyboard shortcuts

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