types

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2025 License: GPL-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package types provides core type definitions for the GoBroke message broker system.

Package types provides core type definitions for the GoBroke message broker system.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Logic

type Logic interface {
	// RunLogic processes a message and returns an error if processing fails.
	RunLogic(Message) error

	// Type returns the LogicType that determines how this handler processes messages.
	Type() LogicType

	// Name returns a unique identifier for this logic handler.
	Name() string
}

Logic defines the interface that all logic handlers must implement. Logic handlers are responsible for processing messages within the GoBroke system.

type LogicType

type LogicType int

LogicType represents the execution mode of a logic handler.

const (
	// DISPATCHED indicates the logic handler runs in a new goroutine for each message.
	DISPATCHED LogicType = iota

	// WORKER indicates the logic handler processes messages sequentially.
	WORKER

	// PASSIVE indicates the logic handler only observes messages without processing.
	PASSIVE
)

type Message

type Message struct {
	// ToClient is a slice of client recipients for this message
	ToClient []*clients.Client

	// ToLogic is a slice of logic handlers that should process this message
	ToLogic []Logic

	// FromClient identifies the client that originated this message, if any
	FromClient *clients.Client

	// FromLogic identifies the logic handler that originated this message, if any
	FromLogic Logic

	// MessageRaw contains the raw message payload as bytes
	MessageRaw []byte

	// Metadata holds additional key-value pairs associated with the message
	Metadata map[string]any

	// UUID uniquely identifies this message instance
	UUID string
}

Message represents a communication unit within the GoBroke system. It contains routing information, payload data, and metadata for message processing.

Jump to

Keyboard shortcuts

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