Remove global Postgres schema registration in favor of explicit schema-aware sink factory wiring, and update weatherfeeder to register the Postgres sink explicitly. Add optional per-source HTTP timeout and response body limit overrides while keeping feedkit defaults. Remove remaining legacy source/config compatibility surfaces, including singular kind support and old source registry/type aliases, and migrate weatherfeeder sources to plural `Kinds()` metadata. Clean up related docs, tests, and sample config to match the new Postgres, HTTP, and NATS configuration model.
47 lines
1.5 KiB
Go
47 lines
1.5 KiB
Go
package sources
|
|
|
|
import (
|
|
"context"
|
|
|
|
"gitea.maximumdirect.net/ejr/feedkit/event"
|
|
)
|
|
|
|
// Input is the common surface shared by all source types.
|
|
//
|
|
// A source may be polling (PollSource) or event-driven (StreamSource).
|
|
// Both source types emit domain-agnostic event.Event values.
|
|
type Input interface {
|
|
Name() string
|
|
}
|
|
|
|
// PollSource is a configured polling source that emits 0..N events per poll.
|
|
//
|
|
// PollSource implementations live in domain modules (weatherfeeder/newsfeeder/...)
|
|
// and are registered into a feedkit sources.Registry.
|
|
//
|
|
// feedkit infrastructure treats PollSource as opaque; it just calls Poll()
|
|
// on the configured cadence and publishes the resulting events.
|
|
type PollSource interface {
|
|
// Name is the configured source name (used for logs and included in emitted events).
|
|
Name() string
|
|
|
|
// Poll fetches/processes one input batch and returns 0..N events.
|
|
// A single poll can emit multiple event kinds.
|
|
// Implementations should honor ctx.Done() for network calls and other I/O.
|
|
Poll(ctx context.Context) ([]event.Event, error)
|
|
}
|
|
|
|
// StreamSource is an event-driven source (NATS/RabbitMQ/MQTT/etc).
|
|
//
|
|
// Run should block, producing events into `out` until ctx is cancelled or a fatal error occurs.
|
|
// It MUST NOT close out (the scheduler/daemon owns the bus).
|
|
type StreamSource interface {
|
|
Input
|
|
Run(ctx context.Context, out chan<- event.Event) error
|
|
}
|
|
|
|
// KindsSource is an optional interface for sources that advertise multiple kinds.
|
|
type KindsSource interface {
|
|
Kinds() []event.Kind
|
|
}
|