Documentation
¶
Overview ¶
Package notification is the composition root for the notification feature. It wires the in-process service implementation and exposes it through typed service keys and optional HTTP routes.
Index ¶
- type GRPCRemoteModule
- type GRPCServerModule
- func (m *GRPCServerModule) Addr() net.Addr
- func (m *GRPCServerModule) DependsOn() []string
- func (m *GRPCServerModule) Init(_ context.Context, reg modulex.Registry) error
- func (m *GRPCServerModule) Name() string
- func (m *GRPCServerModule) Start(ctx context.Context) error
- func (m *GRPCServerModule) Stop(ctx context.Context) error
- type Module
- type RemoteModule
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GRPCRemoteModule ¶ added in v0.6.0
type GRPCRemoteModule struct {
// contains filtered or unexported fields
}
GRPCRemoteModule registers a remote gRPC client adapter as the notification service, dialing target. It is the gRPC counterpart of RemoteModule (which does the same over HTTP): both register ports.ServiceKey so a dependent module (e.g. consumer) does not change depending on which transport backs the port.
func NewGRPCRemoteModule ¶ added in v0.6.0
func NewGRPCRemoteModule(target string) (*GRPCRemoteModule, error)
NewGRPCRemoteModule creates a notification module that proxies to a remote gRPC service at target (e.g. "localhost:50051" or "dns:///notify:50051").
func (*GRPCRemoteModule) DependsOn ¶ added in v0.6.0
func (m *GRPCRemoteModule) DependsOn() []string
func (*GRPCRemoteModule) Init ¶ added in v0.6.0
Init dials the remote gRPC service and registers the client adapter under the same typed key the local module uses. grpc.NewClient does not connect eagerly, so a dial failure here would only be a local configuration error (e.g. an invalid target string); actual connectivity problems surface from the first RPC.
func (*GRPCRemoteModule) Name ¶ added in v0.6.0
func (m *GRPCRemoteModule) Name() string
func (*GRPCRemoteModule) Stop ¶ added in v0.6.0
func (m *GRPCRemoteModule) Stop(_ context.Context) error
Stop implements modulex.Stopper, closing the dialed connection this module created — the resource-ownership convention the lifecycle guide describes: a module that creates its own resources releases them in Stop.
type GRPCServerModule ¶ added in v0.6.0
type GRPCServerModule struct {
// contains filtered or unexported fields
}
GRPCServerModule hosts the notification service over gRPC. It depends on the "notification" module (either Module or RemoteModule providing a local implementation would be unusual, but any module providing ports.ServiceKey works) having already registered ports.ServiceKey, and registers a modulexgrpc.Server that the Manager starts and gracefully stops as part of its own Start/Stop lifecycle — this is the "server lifecycle ownership" half of the gRPC example: the Manager, not main(), owns starting and stopping the gRPC listener.
func NewGRPCServerModule ¶ added in v0.6.0
func NewGRPCServerModule(addr string) *GRPCServerModule
NewGRPCServerModule creates a module that serves the notification service over gRPC on addr (e.g. ":50051").
func (*GRPCServerModule) Addr ¶ added in v0.6.0
func (m *GRPCServerModule) Addr() net.Addr
Addr returns the address the gRPC listener is bound to. It is only valid after InitModules has run (e.g. useful when addr was given as ":0" or "127.0.0.1:0" and the actual ephemeral port must be discovered, such as in tests); it returns nil beforehand.
func (*GRPCServerModule) DependsOn ¶ added in v0.6.0
func (m *GRPCServerModule) DependsOn() []string
func (*GRPCServerModule) Init ¶ added in v0.6.0
Init resolves the notification service, builds the *grpc.Server (wiring trace propagation, consistent error mapping, and health integration), and binds the listener. The server is not started here — Start does that — but binding the listener in Init means a bad address fails fast during InitModules rather than silently during StartModules.
func (*GRPCServerModule) Name ¶ added in v0.6.0
func (m *GRPCServerModule) Name() string
func (*GRPCServerModule) Start ¶ added in v0.6.0
func (m *GRPCServerModule) Start(ctx context.Context) error
Start implements modulex.Starter, delegating to the wrapped modulexgrpc.Server.
func (*GRPCServerModule) Stop ¶ added in v0.6.0
func (m *GRPCServerModule) Stop(ctx context.Context) error
Stop implements modulex.Stopper, delegating to the wrapped modulexgrpc.Server. This is what performs the bounded graceful shutdown documented on modulexgrpc.Server when Manager.StopModules runs.
type Module ¶
type Module struct{}
Module wires the notification service and HTTP handlers.
type RemoteModule ¶
type RemoteModule struct {
// contains filtered or unexported fields
}
RemoteModule registers a remote HTTP client adapter as the notification service. It is used in standalone deployments where the real notification service runs in a separate process.
func NewRemoteModule ¶
func NewRemoteModule(baseURL string, client *http.Client) (*RemoteModule, error)
NewRemoteModule creates a notification module that proxies to a remote service over HTTP.
func (*RemoteModule) DependsOn ¶
func (m *RemoteModule) DependsOn() []string
func (*RemoteModule) Init ¶
Init registers the remote client adapter under the same typed key the local module uses.
func (*RemoteModule) Name ¶
func (m *RemoteModule) Name() string
Directories
¶
| Path | Synopsis |
|---|---|
|
Package adapters provides infrastructure adapters for the notification feature.
|
Package adapters provides infrastructure adapters for the notification feature. |
|
Package ports defines the inbound and outbound contracts for the notification feature.
|
Package ports defines the inbound and outbound contracts for the notification feature. |
|
Package service contains the core business logic for the notification feature.
|
Package service contains the core business logic for the notification feature. |