Help us shape the future of Go! Take the 2026 Go Developer Survey

eventbus

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventCRUD        = "crud"
	EventEventFanout = "event.fanout"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ClusteringHandler

type ClusteringHandler func(v []byte)

type CrudData

type CrudData struct {
	Entity    string          `json:"entity"`
	ID        string          `json:"id"`
	WID       string          `json:"wid"`
	CacheName string          `json:"cache_name"`
	Data      json.RawMessage `json:"data"`
}

func (*CrudData) Marshal

func (m *CrudData) Marshal() ([]byte, error)

type EventBus

type EventBus interface {
	ClusteringBroadcast(ctx context.Context, channel string, value Marshaler) error
	ClusteringSubscribe(channel string, handler ClusteringHandler)
	Broadcast(ctx context.Context, channel string, value interface{})
	Subscribe(channel string, handler Handler)
}

type EventFanoutData

type EventFanoutData struct {
	EventId    string   `json:"event_id"`
	AttemptIds []string `json:"attempt_ids"`
}

func (*EventFanoutData) Marshal

func (m *EventFanoutData) Marshal() ([]byte, error)

type Handler

type Handler func(v interface{})

type Marshaler

type Marshaler interface {
	Marshal() ([]byte, error)
}

type PostgresEventBus

type PostgresEventBus struct {
	// contains filtered or unexported fields
}

func NewPostgresEventBus

func NewPostgresEventBus(nodeID string, dsn string, log *zap.SugaredLogger, db *sql.DB) *PostgresEventBus

func (*PostgresEventBus) Broadcast

func (b *PostgresEventBus) Broadcast(ctx context.Context, channel string, value interface{})

func (*PostgresEventBus) ClusteringBroadcast

func (b *PostgresEventBus) ClusteringBroadcast(ctx context.Context, channel string, value Marshaler) error

func (*PostgresEventBus) ClusteringSubscribe

func (b *PostgresEventBus) ClusteringSubscribe(channel string, handler ClusteringHandler)

func (*PostgresEventBus) Name

func (b *PostgresEventBus) Name() string

func (*PostgresEventBus) Start

func (b *PostgresEventBus) Start() error

func (*PostgresEventBus) Stop

func (b *PostgresEventBus) Stop(ctx context.Context) error

func (*PostgresEventBus) Subscribe

func (b *PostgresEventBus) Subscribe(channel string, handler Handler)

Jump to

Keyboard shortcuts

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