service
Package service defines the interfaces of a microservice. The Connector implements all of them.
The top-level Service interface is a composition of narrower interfaces, each covering a distinct capability: Publisher and Subscriber for transport, Logger for logging, Meter and MeterDescriber for metrics, Tracer for distributed tracing, StarterStopper for lifecycle management, Identifier for addressing, Configurable for configuration, Resourcer for embedded resources, Ticker for scheduled jobs, Timer for time management, and Executor for launching goroutines.
These fine-grained interfaces allow downstream code to depend on only the capabilities it needs.
Executor
Executor is the two-method interface for running work in goroutines the framework can account for:
type Executor interface {
Go(ctx context.Context, f func(ctx context.Context) (err error)) error
Parallel(ctx context.Context, jobs ...func(ctx context.Context) (err error)) error
}Both take a context and hand each job one of its own. Parallel gives every job a cancelable subcontext derived from the one passed in, and cancels it as soon as any sibling returns an error — so a job that observes its context can abandon work the caller no longer needs. A job that must run to completion regardless names its parameter _ and captures the outer context instead.
Prefer these over a bare go statement for anything launched in response to a request: both parent on the microservice’s lifetime context, copy the frame and trace span across, and count against the in-flight counter that graceful shutdown drains.