connectorv1

package
v1.53.0 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BindableTypeJson    = "json"
	BindableTypeYaml    = "yaml"
	BindableTypeUnknown = ""
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Bindable

type Bindable interface {
	Raw() ([]byte, error)
	Bind(any) error
}

func NewBindable added in v1.30.0

func NewBindable(data []byte, tp BindableType) Bindable

type BindableType added in v1.30.0

type BindableType string

type Config added in v1.30.0

type Config struct {
	Ingress         []ingressConfig `yaml:"ingress"`
	ConnectorConfig connectorConfig `yaml:"config"`
}

type Connector

type Connector interface {
	// Start can be used to initialise your server or client
	// Note: This function should return and not block
	Start(ctx StartContext) error
	Stop(ctx StopContext) error
}

type ConnectorOpts added in v1.30.0

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

type ConnectorWorker added in v1.30.0

type ConnectorWorker interface {
	Run()
}

func NewConnectorWorker added in v1.30.0

func NewConnectorWorker(connector Connector, options ...Option) (ConnectorWorker, error)

type ForwardOption added in v1.48.0

type ForwardOption func(*forwardData)

func WithRequestTimeout added in v1.48.0

func WithRequestTimeout(t int) ForwardOption

WithRequestTimeout with the timeout in ms

type Forwarder

type Forwarder interface {
	Forward(name string, body []byte, headers Headers, opts ...ForwardOption) (InboundResponse, error)
}

type Headers

type Headers = map[string]string

type HealthCheckFunc added in v1.30.0

type HealthCheckFunc func() error

type HttpError added in v1.30.0

type HttpError struct {
	HttpCode int    `json:"http_code"`
	Reason   string `json:"reason"`
	Raw      []byte `json:"raw"`
}

func (*HttpError) Error added in v1.30.0

func (he *HttpError) Error() string

type InboundConnector

type InboundConnector interface {
	Connector
}

type InboundDescriptor

type InboundDescriptor interface {
	MessageDescriptor
}

type InboundRequest added in v1.30.0

type InboundRequest interface {
	MessageName() string
	MimeType() string
	// contains filtered or unexported methods
}

type InboundResponse

type InboundResponse interface {
	// contains filtered or unexported methods
}

type Ingress

type Ingress interface {
	ExternalAddress() string
	InternalPort() int
	InternalHost() string
}

type Logger

type Logger interface {
	Error(err error, format string, v ...interface{})
	Fatal(err error, format string, v ...interface{}) // this will crash the service
	Info(format string, v ...interface{})
	Warn(format string, v ...interface{})
	Debug(format string, v ...interface{})
}

type MessageDescriptor added in v1.30.0

type MessageDescriptor interface {
	Name() string
	MessageName() string
	MimeType() string
	MessageType() MessageType
	Config() Bindable
}

type MessageType added in v1.30.0

type MessageType string
const MessageTypeInbound MessageType = "inbound"
const MessageTypeOutbound MessageType = "outbound"

type Option added in v1.30.0

type Option = func(je *ConnectorOpts) *ConnectorOpts

func WithConfig added in v1.30.0

func WithConfig(cfg any) Option

func WithConfigBasePath added in v1.30.0

func WithConfigBasePath(path string) Option

func WithForwarder added in v1.30.0

func WithForwarder(fwd Forwarder) Option

type OutboundConnector

type OutboundConnector interface {
	Connector
	HandleOutboundRequest(request OutboundRequest) (any, Headers, error) // see line 26, please
}

type OutboundDescriptor

type OutboundDescriptor interface {
	MessageDescriptor
}

type OutboundRequest

type OutboundRequest interface {
	MessageName() string
	MimeType() string
	// contains filtered or unexported methods
}

type OutboundResponse added in v1.30.0

type OutboundResponse interface {
	// contains filtered or unexported methods
}

type StartContext

type StartContext interface {
	Config() Bindable
	Ingress(name string) (Ingress, error)
	InboundDescriptors() []InboundDescriptor
	OutboundDescriptors() []OutboundDescriptor
	Forwarder() Forwarder
	Log() Logger
	RegisterPeriodicHealthCheck(name string, fn HealthCheckFunc)
}

type StopContext

type StopContext interface {
	Log() Logger
}

Directories

Path Synopsis
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