MCPcopy
hub / github.com/nats-io/nats.go / CleanupPublisher

Method CleanupPublisher

js.go:779–798  ·  view source on GitHub ↗

CleanupPublisher will cleanup the publishing side of JetStreamContext. This will unsubscribe from the internal reply subject if needed. All pending async publishes will fail with ErrJetStreamContextClosed. If an error handler was provided, it will be called for each pending async publish and Publi

()

Source from the content-addressed store, hash-verified

777// will be recreated on next publish, but the acks from previous publishes will
778// be lost.
779func (js *js) CleanupPublisher() {
780 js.cleanupReplySub()
781 js.mu.Lock()
782 errCb := js.opts.aecb
783 for id, paf := range js.pafs {
784 paf.err = ErrJetStreamPublisherClosed
785 if paf.errCh != nil {
786 paf.errCh <- paf.err
787 }
788 if errCb != nil {
789 defer errCb(js, paf.msg, ErrJetStreamPublisherClosed)
790 }
791 delete(js.pafs, id)
792 }
793 if js.dch != nil {
794 close(js.dch)
795 js.dch = nil
796 }
797 js.mu.Unlock()
798}
799
800func (js *js) cleanupReplySub() {
801 js.mu.Lock()

Callers

nothing calls this directly

Calls 1

cleanupReplySubMethod · 0.95

Tested by

no test coverage detected