js: Replace JetStreamManager listers with iterators

This commit is contained in:
Jaime Piña
2021-03-09 13:23:59 -08:00
parent e61aa9efa2
commit 994c933b84
3 changed files with 140 additions and 91 deletions

8
js.go
View File

@@ -115,7 +115,8 @@ type JetStreamContext interface {
// js is an internal struct from a JetStreamContext.
type js struct {
nc *Conn
ctx context.Context
nc *Conn
// For importing JetStream from other accounts.
pre string
// Amount of time to wait for API requests.
@@ -363,6 +364,11 @@ func (ctx ContextOpt) configurePublish(opts *pubOpts) error {
return nil
}
func (ctx ContextOpt) configureJSContext(opts *js) error {
opts.ctx = ctx
return nil
}
// Context returns an option that can be used to configure a context.
func Context(ctx context.Context) ContextOpt {
return ContextOpt{ctx}