Documentation
¶
Index ¶
- type NatsRealtimeBus
- func (b *NatsRealtimeBus) Close() error
- func (b *NatsRealtimeBus) Publish(_ context.Context, topic string, payload []byte) error
- func (b *NatsRealtimeBus) Subscribe(ctx context.Context, topic string) (<-chan []byte, error)
- func (b *NatsRealtimeBus) SubscribeReplay(ctx context.Context, topic string, policy interfaces.ReplayPolicy) (<-chan []byte, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type NatsRealtimeBus ¶
type NatsRealtimeBus struct {
// contains filtered or unexported fields
}
NatsRealtimeBus is a NATS-backed fan-out bus with optional JetStream durability.
func GetNatsRealtimeBus ¶
func GetNatsRealtimeBus(cfg *models.Config) (*NatsRealtimeBus, error)
GetNatsRealtimeBus builds a NATS realtime bus, embedding a server when needed.
func (*NatsRealtimeBus) Close ¶
func (b *NatsRealtimeBus) Close() error
Close drains the connection and shuts down the embedded server if present.
func (*NatsRealtimeBus) Publish ¶
Publish sends payload on the NATS subject (JetStream when enabled).
func (*NatsRealtimeBus) Subscribe ¶
Subscribe creates a live-tail subscription (DeliverNew when JetStream is on).
func (*NatsRealtimeBus) SubscribeReplay ¶
func (b *NatsRealtimeBus) SubscribeReplay(ctx context.Context, topic string, policy interfaces.ReplayPolicy) (<-chan []byte, error)
SubscribeReplay delivers historical messages per policy then continues live.
Click to show internal directories.
Click to hide internal directories.