Documentation
¶
Index ¶
Constants ¶
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 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 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 ¶
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