api

package
v0.0.0-...-d09eed2 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ContextKeyCamelContext = ContextKey("camel-context")
	ContextKeyActorContext = ContextKey("actor-context")
)

Variables

This section is empty.

Functions

func ExtractActorContext

func ExtractActorContext(ctx context.Context) actor.Context

func Wrap

func Wrap(_ context.Context, camelContext Context) context.Context

Types

type Closer

type Closer interface {
	// Close closes the resource.
	Close(context.Context) error
}

type Component

type Component interface {
	Identifiable

	Context() Context
	Scheme() string
	Endpoint(Parameters) (Endpoint, error)

	Logger() *slog.Logger
}

type Consumer

type Consumer interface {
	Service
	Verticle

	Endpoint() Endpoint
}

type ConsumerFactory

type ConsumerFactory interface {
	Consumer(pid *actor.PID) (Consumer, error)
}

type Context

type Context interface {
	Identifiable
	Service
	Closer

	Registry() Registry
	Properties() Properties
	TypeConverter() TypeConverter

	LoadRoutes(ctx context.Context, in io.Reader) error

	// Spawn ---
	// TODO: must be hidden
	// TODO: each route must have its own context/supervisor
	Spawn(Verticle) (*actor.PID, error)

	// Send ---
	Send(string, Message) error

	// SendTo ---
	// TODO: must be hidden maybe
	SendTo(*actor.PID, Message) error

	// SendToAs ---
	// TODO: must be hidden maybe
	SendToAs(*actor.PID, *actor.PID, Message) error

	// Receive ---
	Receive(string, time.Duration) (Message, error)

	// Request ---
	// TODO: must be hidden maybe
	RequestTo(*actor.PID, Message, time.Duration) (Message, error)

	Logger() *slog.Logger

	NewMessage() Message
}

func ExtractContext

func ExtractContext(ctx context.Context) Context

type ContextKey

type ContextKey string

type Endpoint

type Endpoint interface {
	Identifiable
	Service

	Context() Context
	Component() Component

	Logger() *slog.Logger
}

type Identifiable

type Identifiable interface {
	ID() string
}

type Message

type Message interface {
	ID() string
	Time() time.Time

	Context() Context

	Type() string
	Source() string
	Subject() string
	ContentSchema() string
	ContentType() string

	SetType(string)
	SetSource(string)
	SetSubject(string)
	SetContentSchema(string)
	SetContentType(string)

	// Content ---
	// TODO: add options Content(opt.AsType(baz{})).
	Content() interface{}
	SetContent(interface{})

	// Error ---
	Error() error
	SetError(error)

	// Headers ---
	Headers() map[string]any
	SetHeaders(map[string]any)
	Header(string) (any, bool)
	SetHeader(string, any)
	EachHeader(func(string, any) error) error

	// Attributes ---
	Attributes() map[string]any
	SetAttributes(map[string]any)
	Attribute(string) (any, bool)
	SetAttribute(string, any)
	EachAttribute(func(string, any) error) error

	CopyTo(message Message) error
}

type Parameters

type Parameters map[string]interface{}

type Predicate

type Predicate = func(context.Context, Message) (bool, error)

type Processor

type Processor = func(context.Context, Message) error

type Producer

type Producer interface {
	Service
	Verticle

	Endpoint() Endpoint
}

type ProducerFactory

type ProducerFactory interface {
	Producer() (Producer, error)
}

type Properties

type Properties interface {
	PropertiesResolver

	Add(map[string]any) error
	AddSource(string) error

	View(string) PropertiesResolver
}

type PropertiesResolver

type PropertiesResolver interface {
	Parameters() Parameters

	Expand(string) (string, bool)
	ExpandAll(map[string]any) map[string]any

	Merge(map[string]any) (PropertiesResolver, error)
}

type RawJSON

type RawJSON map[string]interface{}

type Registry

type Registry interface {
	Get(string) (interface{}, bool)
	Set(string, interface{})
	Del(key string) interface{}
}

type Service

type Service interface {
	Start(context.Context) error
	Stop(context.Context) error
}

type Transformer

type Transformer = func(context.Context, Message) (any, error)

type TypeConverter

type TypeConverter interface {
	Convert(interface{}, interface{}) (bool, error)
}

type Verticle

type Verticle interface {
	Identifiable

	actor.Actor
}

Jump to

Keyboard shortcuts

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