Documentation
¶
Overview ¶
Package memory provides an in-process backplane.Backplane using Go channels.
This adapter is intended for testing multi-node scenarios in a single process. It is NOT suitable for production deployments.
Standalone usage ¶
bp := memory.New("node-1")
Multi-node testing with a Hub ¶
hub := memory.NewHub()
bp1 := memory.NewWithHub("node-1", hub)
bp2 := memory.NewWithHub("node-2", hub)
Characteristics ¶
- Subscriber channels are buffered (capacity 64). Messages are dropped if a subscriber falls behind.
- Hub connects multiple backplanes so a message published by one is delivered to all others.
- Self-message filtering is handled by the adapter: subscribers skip messages whose SourceID matches the local node ID.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Backplane ¶
type Backplane struct {
// contains filtered or unexported fields
}
Backplane is an in-process backplane.Backplane that broadcasts messages via Go channels. All subscribers in the same process receive every message.
Create one with New for standalone use or NewWithHub for multi-node testing.
func NewWithHub ¶
NewWithHub creates a Backplane connected to hub so that published messages are delivered to all other backplanes registered on the same Hub.
type Hub ¶
type Hub struct {
// contains filtered or unexported fields
}
Hub connects multiple in-process Backplane instances so that a message published by one is delivered to all others. Use NewHub to create a hub, then NewWithHub to create backplanes that share it.