topiclistener

package
v3.87.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseHandler

type BaseHandler struct{}

BaseHandler implements default behavior for EventHandler interface you must embed the structure to your own implementation of the interface.

It allows to extend the interface in the future without broke compatibility

Temporary restrictions: all method should be work fast, because is it call from main read loop message and block handle messages loop

Experimental: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#experimental

func (BaseHandler) OnReadMessages

func (b BaseHandler) OnReadMessages(
	ctx context.Context,
	event *ReadMessages,
) error

func (BaseHandler) OnReaderCreated

func (b BaseHandler) OnReaderCreated(event *ReaderReady) error

func (BaseHandler) OnStartPartitionSessionRequest

func (b BaseHandler) OnStartPartitionSessionRequest(
	ctx context.Context,
	event *EventStartPartitionSession,
) error

func (BaseHandler) OnStopPartitionSessionRequest

func (b BaseHandler) OnStopPartitionSessionRequest(
	ctx context.Context,
	event *EventStopPartitionSession,
) error

OnStopPartitionSessionRequest called when server want to stop send messages for the partition the method may be called more than once for partition session: with graceful shutdown and without no guarantee to call with graceful=false after graceful true it called with partition context if partition exists and with cancelled background context if not

type EventHandler

type EventHandler interface {
	topiclistenerinternal.EventHandler

	// OnReaderCreated called once at the reader complete internal initialization
	// It not mean that reader is connected to a server.
	// Allow easy initialize your handler with the reader without sync with return of topic.Client StartListener method
	// Experimental: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#experimental
	OnReaderCreated(event *ReaderReady) error
	// contains filtered or unexported methods
}

EventHandler methods will be called sequentially by partition, but can be called in parallel for different partitions. You should include topiclistener.BaseHandler into your struct for the interface implementation It allows to extend the interface in the future without broke compatibility.

Experimental: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#experimental

type EventStartPartitionSession added in v3.76.2

type EventStartPartitionSession = topiclistenerinternal.PublicEventStartPartitionSession

type EventStopPartitionSession added in v3.76.2

type EventStopPartitionSession = topiclistenerinternal.PublicEventStopPartitionSession

type ReaderReady

type ReaderReady struct {
	Listener *TopicListener
}

type TopicListener

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

func NewTopicListener

func NewTopicListener(
	client *rawtopic.Client,
	config *topiclistenerinternal.StreamListenerConfig,
	handler EventHandler,
) (*TopicListener, error)

func (*TopicListener) Close

func (cr *TopicListener) Close(ctx context.Context) error

func (*TopicListener) WaitInit

func (cr *TopicListener) WaitInit(ctx context.Context) error

func (*TopicListener) WaitStop

func (cr *TopicListener) WaitStop(ctx context.Context) error

Jump to

Keyboard shortcuts

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