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 ¶
- func NewClientMessage(From *clients.Client, ToClients []*clients.Client, ToLogic []types.Logic, ...) types.Message
- func NewLogicMessage(From types.Logic, ToClients []*clients.Client, ToLogic []types.Logic, ...) types.Message
- func NewSimpleClientMessage(From *clients.Client, ToClient *clients.Client, ToLogic types.Logic, ...) types.Message
- func NewSimpleLogicMessage(From types.Logic, ToClient *clients.Client, ToLogic types.Logic, ...) types.Message
- func WithMetadata(metadata map[string]any) messageOptsFunc
- func WithUUID(uuid string) messageOptsFunc
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 ¶
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.
Types ¶
This section is empty.