feat: add declarative Options.Streams for automatic JetStream stream creation
Some checks failed
CI / Build and Test (push) Has been cancelled
Some checks failed
CI / Build and Test (push) Has been cancelled
Streams listed in Options.Streams are created by Start() when the embedded NATS server initializes, replacing manual EnsureStream calls during setup. Migrates nats-chatroom and pubsub-crud examples.
This commit is contained in:
@@ -53,10 +53,15 @@ type Options struct {
|
||||
// Defaults to "/_datastar.js" if empty.
|
||||
DatastarPath string
|
||||
|
||||
// PubSub enables publish/subscribe messaging. Use vianats.New() for an
|
||||
// embedded NATS backend, or supply any PubSub implementation.
|
||||
// PubSub enables publish/subscribe messaging. When nil, an embedded NATS
|
||||
// server starts automatically in Start(). Supply any PubSub implementation
|
||||
// to replace it.
|
||||
PubSub PubSub
|
||||
|
||||
// Streams declares JetStream streams to create when Start() initializes
|
||||
// the embedded NATS server. Ignored when a custom PubSub is configured.
|
||||
Streams []StreamConfig
|
||||
|
||||
// ContextSuspendAfter is the time a context may be disconnected before
|
||||
// the reaper suspends it (frees page resources but keeps the context
|
||||
// shell for seamless re-init on reconnect). Default: 15m.
|
||||
|
||||
Reference in New Issue
Block a user