multiserver

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2026 License: MIT Imports: 8 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

fx/modules/extra/multiserver

fx module that serves every multiserver.Server provided in the extra.multiserver.servers group (ServersGroupKey) — e.g. the echo and gRPC server modules.

fxfact.NewApp(
	echofx.Module(),
	multiserver.Module(),
).Run()

Lifecycle

  • OnStart — multiserver.Serve runs in a goroutine, so fx.New returns and app.Run() listens for SIGINT/SIGTERM.
  • OnStop — Shutdown(stopCtx) is called on every server concurrently, then the hook waits for them to drain and for Serve to return, bounded by the stop context (fx's stop timeout); it returns the context error if the drain does not finish in time. The context passed to Serve is cancelled afterwards.
  • Every server stopped on its own (no stop requested) — the app is shut down with exit code 1. One server down while others run is reported by multiserver.Check (health), not by shutting down.
  • No servers in the group — fx.New fails with multiserver: no servers configured.

Documentation

Index

Constants

View Source
const (
	ServersGroupKey = "extra.multiserver.servers"
)

Variables

This section is empty.

Functions

func Module

func Module() fx.Option

Module fx module for multiserver. The servers start on the app's OnStart and drain on its OnStop, so app.Run handles SIGTERM gracefully.

Types

This section is empty.

Jump to

Keyboard shortcuts

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