message

package
v0.3.0-prerelease.5 Latest Latest
Warning

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

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

Documentation

Overview

Package message exposes the generic Message type, used to represent a message in a system (e.g. Event, Command, etc.).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Envelope

type Envelope[T Message] struct {
	Message  T
	Metadata Metadata
}

Envelope bundles a Message to be exchanged with optional Metadata support.

func (Envelope[T]) ToGenericEnvelope

func (e Envelope[T]) ToGenericEnvelope() GenericEnvelope

ToGenericEnvelope maps the Envelope instance into a GenericEnvelope one.

type GenericEnvelope

type GenericEnvelope Envelope[Message]

GenericEnvelope is an Envelope type that can be used when the concrete Message type in the Envelope is not of interest.

type Message

type Message interface {
	Name() string
}

Message is a Message payload.

Each payload should have a unique name identifier, that can be used to uniquely route a message to its type.

type Metadata

type Metadata map[string]string

Metadata contains some data related to a Message that are not functional for the Message itself, but instead functioning as supporting information to provide additional context.

func (Metadata) Merge

func (m Metadata) Merge(other Metadata) Metadata

Merge merges the other Metadata provided in input with the current map. Returns a pointer to the extended metadata map.

func (Metadata) With

func (m Metadata) With(key, value string) Metadata

With returns a new Metadata reference holding the value addressed using the specified key.

Jump to

Keyboard shortcuts

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