msgsync

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package msgsync propagates protobuf messages to a particular topic.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Topic string
}

Config groups configurations fields. It can be extended with other fields (such as sync/async, partition...).

type Deps

type Deps struct {
	infra.PluginDeps
	Messaging messaging.Mux
}

Deps groups dependencies injected into the plugin so that they are logically separated from other plugin fields.

type Option

type Option func(*Plugin)

Option is a function that can be used in NewPlugin to customize Plugin.

func UseConf

func UseConf(conf Config) Option

UseConf returns Option which injects a particular configuration.

func UseDeps

func UseDeps(cb func(*Deps)) Option

UseDeps returns Option that can inject custom dependencies.

func UseMessaging

func UseMessaging(m messaging.Mux) Option

UseMessaging returns Option that sets Messaging.

type Plugin

type Plugin struct {
	Deps

	Config
	// contains filtered or unexported fields
}

Plugin implements KeyProtoValWriter that propagates protobuf messages to a particular topic (unless the messaging.Mux is not disabled).

func NewPlugin

func NewPlugin(opts ...Option) *Plugin

NewPlugin creates a new Plugin with the provided Options.

func (*Plugin) AfterInit

func (p *Plugin) AfterInit() error

AfterInit uses provided MUX connection to build new publisher.

func (*Plugin) Close

func (p *Plugin) Close() error

Close resources.

func (*Plugin) Init

func (p *Plugin) Init() error

Init does nothing.

func (*Plugin) Put

func (p *Plugin) Put(key string, data proto.Message, opts ...datasync.PutOption) error

Put propagates this call to a particular messaging Publisher.

This method is supposed to be called in PubPlugin.AfterInit() or later (even from different go routine).

Jump to

Keyboard shortcuts

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