factory

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2026 License: MIT Imports: 104 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildConnectionString

func BuildConnectionString(cfg map[string]string, sourceType string) string

func CreateSink

func CreateSink(cfg SinkConfig) (hermod.Sink, error)

func CreateSinkForTransactionGroup

func CreateSinkForTransactionGroup(cfg SinkConfig) (hermod.Sink, error)

CreateSinkForTransactionGroup builds a sink for membership of a transactional group, without the tracing and retry decorators.

Two reasons, and either alone would be enough.

The decorators forward Write, WriteBatch and the discovery calls, but not Begin, Commit, Prepare or CommitPrepared. A decorated sink therefore does not satisfy hermod.TwoPhaseCommit, and a group refuses to start when a member does not — so every group built through the registry failed at startup, while the tests that construct sinks directly passed.

The second reason is why forwarding them through the decorators would be the wrong fix. Retrying a failed Write inside a prepared transaction is not a retry of an idempotent operation: the transaction may already be aborted, and a write that did land would be applied twice within the same prepared transaction. Failure handling for a group belongs to the coordinator, which rolls every participant back together. A member that quietly retried underneath it would be making that decision on its own.

func CreateSource

func CreateSource(cfg SourceConfig) (hermod.Source, error)

func SupportsTwoPhaseCommit

func SupportsTwoPhaseCommit(sinkType string) bool

SupportsTwoPhaseCommit reports whether a sink of this type can be a member of a transactional group.

func TwoPhaseCapableSinkTypes

func TwoPhaseCapableSinkTypes() []string

TwoPhaseCapableSinkTypes returns the sink types that can join a transactional group. The result is a copy: callers sort and filter it.

Types

type SinkConfig

type SinkConfig struct {
	ID     string           `json:"id"`
	Type   string           `json:"type"`
	Config hermod.StringMap `json:"config"`
}

type SourceConfig

type SourceConfig struct {
	ID                 string           `json:"id"`
	Type               string           `json:"type"`
	Config             hermod.StringMap `json:"config"`
	State              hermod.StringMap `json:"state"`
	ReconnectIntervals []time.Duration  `json:"-"`
}

Jump to

Keyboard shortcuts

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