CreateOrUpdateStream creates a stream with the given config. If stream already exists, it will be updated (if possible).
(ctx context.Context, cfg StreamConfig)
| 784 | // CreateOrUpdateStream creates a stream with the given config. If stream |
| 785 | // already exists, it will be updated (if possible). |
| 786 | func (js *jetStream) CreateOrUpdateStream(ctx context.Context, cfg StreamConfig) (Stream, error) { |
| 787 | s, err := js.UpdateStream(ctx, cfg) |
| 788 | if err != nil { |
| 789 | if !errors.Is(err, ErrStreamNotFound) { |
| 790 | return nil, err |
| 791 | } |
| 792 | return js.CreateStream(ctx, cfg) |
| 793 | } |
| 794 | |
| 795 | return s, nil |
| 796 | } |
| 797 | |
| 798 | // Stream fetches [StreamInfo] and returns a [Stream] interface for a given stream name. |
| 799 | // If stream does not exist, ErrStreamNotFound is returned. |
no test coverage detected