Documentation
¶
Overview ¶
Copyright (C) 2025 l3montree GmbH
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
Index ¶
- type Broker
- type Channel
- type Message
- type PostgreSQLBroker
- func (b *PostgreSQLBroker) Close() error
- func (b *PostgreSQLBroker) GetActiveTopics() []Channel
- func (b *PostgreSQLBroker) IsHealthy() bool
- func (b *PostgreSQLBroker) Publish(ctx context.Context, message Message) error
- func (b *PostgreSQLBroker) SetShouldReceiveOwnMessages(should bool)
- func (b *PostgreSQLBroker) Subscribe(topic Channel) (<-chan map[string]interface{}, error)
- type PostgreSQLMessage
- type SimpleMessage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Broker ¶
type Broker interface { Publish(ctx context.Context, message Message) error Subscribe(topic Channel) (<-chan map[string]interface{}, error) }
func BrokerFactory ¶
type PostgreSQLBroker ¶
type PostgreSQLBroker struct { ID string // Unique identifier for the broker instance // contains filtered or unexported fields }
PostgreSQLBroker implements the Broker interface using PostgreSQL LISTEN/NOTIFY
func NewPostgreSQLBroker ¶
func NewPostgreSQLBroker(user, password, host, port, dbname string) (*PostgreSQLBroker, error)
NewPostgreSQLBroker creates a new PostgreSQL broker
func (*PostgreSQLBroker) Close ¶
func (b *PostgreSQLBroker) Close() error
Close stops the broker and cleans up resources
func (*PostgreSQLBroker) GetActiveTopics ¶
func (b *PostgreSQLBroker) GetActiveTopics() []Channel
GetActiveTopics returns a list of topics currently being listened to
func (*PostgreSQLBroker) IsHealthy ¶
func (b *PostgreSQLBroker) IsHealthy() bool
IsHealthy checks if the broker is functioning properly
func (*PostgreSQLBroker) Publish ¶
func (b *PostgreSQLBroker) Publish(ctx context.Context, message Message) error
Publish implements the Broker interface
func (*PostgreSQLBroker) SetShouldReceiveOwnMessages ¶
func (b *PostgreSQLBroker) SetShouldReceiveOwnMessages(should bool)
type PostgreSQLMessage ¶
type PostgreSQLMessage struct { ID string `json:"id"` Channel Channel `json:"topic"` Payload map[string]interface{} `json:"payload"` Timestamp time.Time `json:"timestamp"` SenderID string `json:"sender_id,omitempty"` // Optional field for sender ID }
func (PostgreSQLMessage) GetChannel ¶
func (m PostgreSQLMessage) GetChannel() Channel
func (PostgreSQLMessage) GetPayload ¶
func (m PostgreSQLMessage) GetPayload() map[string]interface{}
type SimpleMessage ¶
func NewSimpleMessage ¶
func NewSimpleMessage(channel Channel, payload map[string]interface{}) *SimpleMessage
NewSimpleMessage creates a new SimpleMessage instance.
func (SimpleMessage) GetChannel ¶
func (m SimpleMessage) GetChannel() Channel
func (SimpleMessage) GetPayload ¶
func (m SimpleMessage) GetPayload() map[string]interface{}