topic

package
v0.0.0-...-cc2de37 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsHardCode

func IsHardCode(topicName string) bool

IsHardCode checks whether a topic name is hard code or not.

Types

type Dispatcher

type Dispatcher interface {
	fmt.Stringer
	Substitute(schema, table string) string
}

Dispatcher is an abstraction for dispatching rows and ddls into different topics.

type DynamicTopicDispatcher

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

DynamicTopicDispatcher is a topic dispatcher which dispatches rows and DDLs dynamically to the target topics.

func NewDynamicTopicDispatcher

func NewDynamicTopicDispatcher(topicExpr Expression) *DynamicTopicDispatcher

NewDynamicTopicDispatcher creates a DynamicTopicDispatcher.

func (*DynamicTopicDispatcher) String

func (d *DynamicTopicDispatcher) String() string

func (*DynamicTopicDispatcher) Substitute

func (d *DynamicTopicDispatcher) Substitute(schema, table string) string

Substitute converts schema/table name in a topic expression to kafka topic name.

type Expression

type Expression string

Expression represent a kafka topic expression. The expression should be in form of: [prefix]{schema}[middle][{table}][suffix] prefix/suffix/middle are optional and should match the regex of [A-Za-z0-9\._\-]* {table} can also be optional.

func (Expression) PulsarValidate

func (e Expression) PulsarValidate() error

PulsarValidate checks whether a pulsar topic name is valid or not.

func (Expression) Substitute

func (e Expression) Substitute(schema, table string) string

Substitute converts schema/table name in a topic expression to kafka topic name. When doing conversion, the special characters other than [A-Za-z0-9\._\-] in schema/table will be substituted for underscore '_'.

func (Expression) Validate

func (e Expression) Validate() error

Validate checks whether a kafka topic name is valid or not. return true if the expression is hard coded.

func (Expression) ValidateForAvro

func (e Expression) ValidateForAvro() error

ValidateForAvro checks whether topic pattern is {schema}_{table}, the only allowed

type StaticTopicDispatcher

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

StaticTopicDispatcher is a topic dispatcher which dispatches rows and DDL to the specific topic.

func NewStaticTopicDispatcher

func NewStaticTopicDispatcher(defaultTopic string) *StaticTopicDispatcher

NewStaticTopicDispatcher returns a StaticTopicDispatcher.

func (*StaticTopicDispatcher) String

func (s *StaticTopicDispatcher) String() string

func (*StaticTopicDispatcher) Substitute

func (s *StaticTopicDispatcher) Substitute(schema, table string) string

Substitute converts schema/table name in a topic expression to kafka topic name.

Jump to

Keyboard shortcuts

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