handler

package
v0.0.0-...-34e0b2d Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2024 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrClientClosed = errors.New("handler client is closed")
)

Functions

This section is empty.

Types

type Consumer

type Consumer = consumer.Consumer

type ConsumerOptions

type ConsumerOptions struct {
	// PChannel is the pchannel of the consumer.
	PChannel string

	// DeliverPolicy is the deliver policy of the consumer.
	DeliverPolicy options.DeliverPolicy

	// DeliverFilters is the deliver filters of the consumer.
	DeliverFilters []options.DeliverFilter

	// Handler is the message handler used to handle message after recv from consumer.
	MessageHandler message.Handler
}

ConsumerOptions is the options for creating a consumer.

type HandlerClient

type HandlerClient interface {
	// CreateProducer creates a producer.
	// Producer is a stream client without keep alive promise.
	// It will be available until context canceled, active close, streaming error or remote server wal closing.
	// Because of there's no more ProducerOptions except PChannel, so a producer of same PChannel is shared by reference count.
	CreateProducer(ctx context.Context, opts *ProducerOptions) (Producer, error)

	// CreateConsumer creates a consumer.
	// Consumer is a stream client without keep alive promise.
	// It will be available until context canceled, active close, streaming error or remote server wal closing.
	// A consumer will not share stream connection with other consumers.
	CreateConsumer(ctx context.Context, opts *ConsumerOptions) (Consumer, error)

	// Close closes the handler client.
	// It will only stop the underlying service discovery, but don't stop the producer and consumer created by it.
	// So please close Producer and Consumer created by it before close the handler client.
	Close()
}

HandlerClient is the interface that wraps streamingpb.StreamingNodeHandlerServiceClient. HandlerClient wraps the PChannel Assignment Service Discovery. Provides the ability to create pchannel-level producer and consumer.

func NewHandlerClient

func NewHandlerClient(w types.AssignmentDiscoverWatcher) HandlerClient

NewHandlerClient creates a new handler client.

type Producer

type Producer = producer.Producer

type ProducerOptions

type ProducerOptions struct {
	// PChannel is the pchannel of the producer.
	PChannel string
}

ProducerOptions is the options for creating a producer.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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