subscription

package
v0.41.1 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnimplementedFunction = newError("unimplemented function")
	ErrUnknownGrpcRequest    = newError("unknown gRPC request")
)
View Source
var (
	ErrSubscribeTimeout = newError("subscribe timeout")
	ErrClosed           = newError("closed")
	ErrNoEvent          = newError("no event")
)

Functions

func NewSubscriber

func NewSubscriber(
	ctx context.Context,
	connection Connection,
	endpoint *Endpoint,
	config *config.Config,
	onPanic func(err error),
) *subscriber

Types

type Connection

type Connection interface {
	Handle(handlerFn HandlerFn) error
	Close()
	Subscribe(ctx context.Context, groupId string, topics []string) error
	EventHandled(ctx context.Context, tenantId string, topic string, errorMessage string) error
}

func NewConnection

func NewConnection(
	ctx context.Context,
	deploymentId int64,
	client managementpb.ServiceClient,
	logger golog.Logger,
	config *config.Config,
) (Connection, error)

type Endpoint

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

func NewEndpoint

func NewEndpoint(logger golog.Logger) *Endpoint

func (*Endpoint) OnEvent

func (e *Endpoint) OnEvent(handler OnEventFn)

func (*Endpoint) OnPanic

func (e *Endpoint) OnPanic(handler OnPanicFn)

func (*Endpoint) OnSubscribed

func (e *Endpoint) OnSubscribed(handler OnSubscribedFn)

func (*Endpoint) UseConnection

func (e *Endpoint) UseConnection(connection Connection) error

type HandlerFn

type HandlerFn func(response *managementpb.SubscribeResponse) error

type OnEventFn

type OnEventFn func(event *managementpb.Event, connection Connection) error

type OnPanicFn

type OnPanicFn func(panic *managementpb.Panic) error

type OnSubscribedFn

type OnSubscribedFn func(subscribed *managementpb.Subscribed) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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