message

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: 3 Imported by: 0

Documentation

Overview

Package message provides functions for creating and managing messages within the GoBroke system. It offers both simple and advanced message creation functions for client-to-client, client-to-logic, and logic-to-logic communication patterns.

Package message provides message creation and configuration options.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewClientMessage

func NewClientMessage(From *clients.Client, ToClients []*clients.Client, ToLogic []types.Logic, MessageRaw []byte, opts ...messageOptsFunc) types.Message

NewClientMessage creates a new message originating from a client. Parameters:

  • From: The client sending the message
  • ToClients: Slice of client recipients
  • ToLogic: Slice of logic handlers to process the message
  • MessageRaw: Raw message payload as bytes
  • opts: Optional message configuration functions

Returns a types.Message configured with the provided parameters and options.

func NewLogicMessage

func NewLogicMessage(From types.Logic, ToClients []*clients.Client, ToLogic []types.Logic, MessageRaw []byte, opts ...messageOptsFunc) types.Message

NewLogicMessage creates a new message originating from a logic handler. Parameters:

  • From: The logic handler sending the message
  • ToClients: Slice of client recipients
  • ToLogic: Slice of logic handlers to process the message
  • MessageRaw: Raw message payload as bytes
  • opts: Optional message configuration functions

Returns a types.Message configured with the provided parameters and options.

func NewSimpleClientMessage

func NewSimpleClientMessage(From *clients.Client, ToClient *clients.Client, ToLogic types.Logic, MessageRaw []byte, opts ...messageOptsFunc) types.Message

NewSimpleClientMessage creates a new message from a client to a single recipient. This is a convenience wrapper around NewClientMessage for single-recipient cases.

Parameters:

  • From: The client sending the message
  • ToClient: The single client recipient
  • ToLogic: Single logic handler to process the message
  • MessageRaw: Raw message payload as bytes
  • opts: Optional message configuration functions

Returns a types.Message configured for single-recipient delivery.

func NewSimpleLogicMessage

func NewSimpleLogicMessage(From types.Logic, ToClient *clients.Client, ToLogic types.Logic, MessageRaw []byte, opts ...messageOptsFunc) types.Message

NewSimpleLogicMessage creates a new message from a logic handler to a single recipient. This is a convenience wrapper around NewLogicMessage for single-recipient cases.

Parameters:

  • From: The logic handler sending the message
  • ToClient: The single client recipient
  • ToLogic: Single logic handler to process the message
  • MessageRaw: Raw message payload as bytes
  • opts: Optional message configuration functions

Returns a types.Message configured for single-recipient delivery.

func WithMetadata

func WithMetadata(metadata map[string]any) messageOptsFunc

WithMetadata returns a messageOptsFunc that sets custom metadata for a message. The metadata can be any key-value pairs that should be associated with the message.

func WithUUID

func WithUUID(uuid string) messageOptsFunc

WithUUID returns a messageOptsFunc that sets a custom UUID for a message. If not used, a new random UUID will be generated by default.

Types

This section is empty.

Jump to

Keyboard shortcuts

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