source

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConfigBufferSize              = "bufferSize"
	ConfigConnectionName          = "connectionName"
	ConfigCredentialsFilePath     = "credentialsFilePath"
	ConfigMaxReconnects           = "maxReconnects"
	ConfigNkeyPath                = "nkeyPath"
	ConfigReconnectWait           = "reconnectWait"
	ConfigSubject                 = "subject"
	ConfigTlsClientCertPath       = "tls.clientCertPath"
	ConfigTlsClientPrivateKeyPath = "tls.clientPrivateKeyPath"
	ConfigTlsRootCACertPath       = "tls.rootCACertPath"
	ConfigUrls                    = "urls"
)

Variables

This section is empty.

Functions

func NewSource

func NewSource() sdk.Source

NewSource creates new instance of the Source.

Types

type Config

type Config struct {
	common.Config

	// A buffer size for consumed messages.
	BufferSize int `json:"bufferSize" default:"1024" validate:"gt=63"`
}

Config holds source specific configurable values.

func (Config) Parameters added in v0.4.0

func (Config) Parameters() map[string]config.Parameter

type Iterator

type Iterator interface {
	HasNext() bool
	Next(ctx context.Context) (opencdc.Record, error)
	Stop() error
}

Iterator defines an iterator interface.

type Source

type Source struct {
	sdk.UnimplementedSource
	// contains filtered or unexported fields
}

Source operates source logic.

func (*Source) Configure

func (s *Source) Configure(ctx context.Context, cfg config.Config) error

Configure parses and initializes the config.

func (*Source) Open

Open opens a connection to NATS and initializes iterators.

func (*Source) Parameters

func (s *Source) Parameters() config.Parameters

Parameters returns a map of named config.Parameters that describe how to configure the Source.

func (*Source) Read

func (s *Source) Read(ctx context.Context) (opencdc.Record, error)

Read fetches a record from an iterator. If there's no record will return sdk.ErrBackoffRetry. If the Source's errC is not empty will return the underlying error.

func (*Source) Teardown

func (s *Source) Teardown(context.Context) error

Teardown closes connections, stops iterator.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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