package topiclistener
import "github.com/ydb-platform/ydb-go-sdk/v3/topic/topiclistener"
Index ¶
- type BaseHandler
- func (b BaseHandler) OnReadMessages( ctx context.Context, event *ReadMessages, ) error
- func (b BaseHandler) OnReaderCreated(event *ReaderReady) error
- func (b BaseHandler) OnStartPartitionSessionRequest( ctx context.Context, event *StartPartitionSessionRequest, ) error
- func (b BaseHandler) OnStopPartitionSessionRequest( ctx context.Context, event *StopPartitionSessionRequest, ) error
- type EventHandler
- type OffsetsRange
- type PartitionSession
- type ReadMessages
- type ReaderReady
- type StartPartitionSessionConfirm
- type StartPartitionSessionRequest
- type StopPartitionSessionConfirm
- type StopPartitionSessionRequest
- type TopicListener
- func NewTopicListener( client *rawtopic.Client, config *topiclistenerinternal.StreamListenerConfig, handler EventHandler, ) (*TopicListener, error)
- func (cr *TopicListener) Close(ctx context.Context) error
- func (cr *TopicListener) WaitInit(ctx context.Context) error
- func (cr *TopicListener) WaitStop(ctx context.Context) error
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
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 *StartPartitionSessionRequest, ) error
func (BaseHandler) OnStopPartitionSessionRequest ¶
func (b BaseHandler) OnStopPartitionSessionRequest( ctx context.Context, event *StopPartitionSessionRequest, ) 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 OffsetsRange ¶
type OffsetsRange = topiclistenerinternal.PublicOffsetsRange
type PartitionSession ¶
type PartitionSession = topicreadercommon.PublicPartitionSession
type ReadMessages ¶
type ReadMessages = topiclistenerinternal.PublicReadMessages
type ReaderReady ¶
type ReaderReady struct { Listener *TopicListener }
type StartPartitionSessionConfirm ¶
type StartPartitionSessionConfirm = topiclistenerinternal.PublicStartPartitionSessionConfirm
type StartPartitionSessionRequest ¶
type StartPartitionSessionRequest = topiclistenerinternal.PublicStartPartitionSessionEvent
type StopPartitionSessionConfirm ¶
type StopPartitionSessionConfirm = topiclistenerinternal.PublicStopPartitionSessionConfirm
type StopPartitionSessionRequest ¶
type StopPartitionSessionRequest = topiclistenerinternal.PublicStopPartitionSessionEvent
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
Source Files ¶
event_handler.go topic_listener.go
- Version
- v3.76.1
- Published
- Jul 29, 2024
- Platform
- linux/amd64
- Imports
- 5 packages
- Last checked
- 3 minutes ago –
Tools for package owners.