connector

package
v0.0.0-...-32ff608 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PluginType = "connector"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CommitFunc

type CommitFunc func(action EventMeshAction) error

CommitFunc user can commit message through this function in the consuming logic

type ConsumeFunc

type ConsumeFunc func(event *ce.Event, commitFunc CommitFunc) error

ConsumeFunc custom message consuming logic

type Consumer

type Consumer interface {
	LifeCycle

	InitConsumer(properties map[string]string) error
	UpdateOffset(ctx context.Context, events []*ce.Event) error
	Subscribe(topicName string) error
	Unsubscribe(topicName string) error
	RegisterEventListener(listener *EventListener)
}

Consumer interface of consumer all the consumers implement this interface should implement a corresponding factory and do plugin registration first.

type ErrorResult

type ErrorResult struct {
	Topic string
	Err   error
}

type EventListener

type EventListener struct {
	Consume ConsumeFunc
}

EventListener message consume handler

type EventMeshAction

type EventMeshAction uint

EventMeshAction commit action of message consume

const (
	CommitMessage EventMeshAction = iota
	ReconsumeLater
	ManualAck
)

type Factory

type Factory interface {
	plugin.Plugin

	GetConsumer() (Consumer, error)
	GetProducer() (Producer, error)
	GetResource() (Resource, error)
}

Factory plugin factory of consumer/producer/resource

type LifeCycle

type LifeCycle interface {
	IsStarted() bool
	IsClosed() bool
	Start() error
	Shutdown() error
}

LifeCycle general life cycle interface for all connectors

type Producer

type Producer interface {
	LifeCycle

	InitProducer(properties map[string]string) error
	Publish(ctx context.Context, event *ce.Event, callback *SendCallback) error
	SendOneway(ctx context.Context, event *ce.Event) error
	Request(ctx context.Context, event *ce.Event, callback *RequestReplyCallback, timeout time.Duration) error
	Reply(ctx context.Context, event *ce.Event, callback *SendCallback) error
	CheckTopicExist(topicName string) (bool, error)
	SetExtFields() error
}

Producer interface of producer all the producers implement this interface should implement a corresponding factory and do plugin registration first.

type RequestReplyCallback

type RequestReplyCallback struct {
	OnSuccess func(event *ce.Event)
	OnError   func(result *ErrorResult)
}

RequestReplyCallback request/reply callback handler of function Request and Reply

type Resource

type Resource interface {
	Init() error
	Release() error
}

Resource interface of resource service all the resources implement this interface should implement a corresponding factory and do plugin registration first.

type SendCallback

type SendCallback struct {
	OnSuccess func(result *SendResult)
	OnError   func(result *ErrorResult)
}

SendCallback send callback handler of function Publish

type SendResult

type SendResult struct {
	MessageId string
	Topic     string
	Err       error
}

Directories

Path Synopsis
mock
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.

Jump to

Keyboard shortcuts

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