outbox

package module
v0.0.0-...-d85f02a Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

README

simple outbox pattern

This is a library for simple outbox pattern.

How to use

example

Documentation

Index

Constants

View Source
const (
	NoRecord int64 = -1
)

Variables

This section is empty.

Functions

func WithConcurrentWorkers

func WithConcurrentWorkers(concurrentWorkers int) func(*Processor)

func WithIntervalMillseconds

func WithIntervalMillseconds(intervalMillseconds int) func(*Processor)

func WithLimitPerFetch

func WithLimitPerFetch(limitPerFetch int) func(*Processor)

func WithMsgBufferSize

func WithMsgBufferSize(msgBufferSize int) func(*Processor)

Types

type MsgHandle

type MsgHandle func(ctx context.Context, msg types.Outbox) error

type Processor

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

func NewProcessor

func NewProcessor(
	name string,
	msgHandle MsgHandle,
	db *sqlx.DB,
	options ...func(*Processor),
) *Processor

func (*Processor) InitCursor

func (p *Processor) InitCursor(ctx context.Context, position int64) error

InitCursor initializes cursor with a processor

func (*Processor) Shutdown

func (p *Processor) Shutdown() error

func (*Processor) Start

func (p *Processor) Start(ctx context.Context) error

Start starts the processor and processes messages from a specified position.

ctx: the context.Context object for cancellation and timeouts. Returns an error if there was an issue processing the messages.

Directories

Path Synopsis
store
pg

Jump to

Keyboard shortcuts

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