topic

package
v3.31.0-rc0 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Example (Topic_read_message)
ctx := context.TODO()
db, err := ydb.Open(ctx, "grpcs://localhost:2135/?database=/local")
if err != nil {
	fmt.Printf("failed connect: %v", err)
	return
}
defer db.Close(ctx) // cleanup resources

reader, err := db.Topic().StartReader("consumer", topicoptions.ReadTopic("/topic/path"))
if err != nil {
	fmt.Printf("failed start reader: %v", err)
	return
}

for {
	mess, err := reader.ReadMessage(ctx)
	if err != nil {
		fmt.Printf("failed start reader: %v", err)
		return
	}

	content, err := ioutil.ReadAll(mess)
	if err != nil {
		fmt.Printf("failed start reader: %v", err)
		return
	}
	fmt.Println(string(content))
}
Output:

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	// Close stop client
	//
	// Experimental
	//
	// Notice: This API is EXPERIMENTAL and may be changed or removed in a
	// later release.
	Close(context.Context) error

	// Alter change topic options
	//
	// Experimental
	//
	// Notice: This API is EXPERIMENTAL and may be changed or removed in a
	// later release.
	Alter(ctx context.Context, path string, opts ...topicoptions.AlterOption) error

	// Create create topic
	//
	// Experimental
	//
	// Notice: This API is EXPERIMENTAL and may be changed or removed in a
	// later release.
	Create(ctx context.Context, path string, codecs []topictypes.Codec, opts ...topicoptions.CreateOption) error

	// Describe describe topic
	//
	// Experimental
	//
	// Notice: This API is EXPERIMENTAL and may be changed or removed in a
	// later release.
	Describe(ctx context.Context, path string, opts ...topicoptions.DescribeOption) (topictypes.TopicDescription, error)

	// Drop drop topic
	//
	// Experimental
	//
	// Notice: This API is EXPERIMENTAL and may be changed or removed in a
	// later release.
	Drop(ctx context.Context, path string, opts ...topicoptions.DropOption) error

	// StartReader start read messages from topic
	// it is fast non block call, connection starts in background
	//
	// Experimental
	//
	// Notice: This API is EXPERIMENTAL and may be changed or removed in a
	// later release.
	StartReader(
		consumer string,
		readSelectors topicoptions.ReadSelectors,
		opts ...topicoptions.ReaderOption,
	) (*topicreader.Reader, error)
}

Client is interface for topic client

Experimental

Notice: This API is EXPERIMENTAL and may be changed or removed in a later release.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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