jetstream

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: May 11, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Iterator

type Iterator struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Iterator is a iterator for JetStream communication model. It receives message from NATS JetStream.

func NewIterator

func NewIterator(params IteratorParams) (*Iterator, error)

NewIterator creates new instance of the Iterator.

func (*Iterator) Ack

func (i *Iterator) Ack(sdkPosition sdk.Position) error

Ack acknowledges a message at the given position.

func (*Iterator) HasNext

func (i *Iterator) HasNext() bool

HasNext checks is the iterator has messages.

func (*Iterator) Next

func (i *Iterator) Next(ctx context.Context) (sdk.Record, error)

Next returns the next record from the underlying messages channel. It also appends messages to a unackMessages slice if the AckPolicy is not equal to AckNonePolicy.

func (*Iterator) Stop

func (i *Iterator) Stop() (err error)

Stop stops the Iterator, unsubscribes from a subject.

type IteratorParams

type IteratorParams struct {
	Conn           *nats.Conn
	BufferSize     int
	Durable        string
	DeliverSubject string
	Subject        string
	SDKPosition    sdk.Position
	DeliverPolicy  nats.DeliverPolicy
	AckPolicy      nats.AckPolicy
}

IteratorParams contains incoming params for the NewIterator function.

Jump to

Keyboard shortcuts

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