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

Method deleteMsg

jetstream/stream.go:695–713  ·  view source on GitHub ↗
(ctx context.Context, req *msgDeleteRequest)

Source from the content-addressed store, hash-verified

693}
694
695func (s *stream) deleteMsg(ctx context.Context, req *msgDeleteRequest) error {
696 ctx, cancel := s.js.wrapContextWithoutDeadline(ctx)
697 if cancel != nil {
698 defer cancel()
699 }
700 r, err := json.Marshal(req)
701 if err != nil {
702 return err
703 }
704 subj := fmt.Sprintf(apiMsgDeleteT, s.name)
705 var resp msgDeleteResponse
706 if _, err = s.js.apiRequestJSON(ctx, subj, &resp, r); err != nil {
707 return err
708 }
709 if !resp.Success {
710 return fmt.Errorf("%w: %s", ErrMsgDeleteUnsuccessful, resp.Error.Error())
711 }
712 return nil
713}
714
715// ListConsumers returns ConsumerInfoLister enabling iterating over a
716// channel of consumer infos.

Callers 2

DeleteMsgMethod · 0.95
SecureDeleteMsgMethod · 0.95

Calls 4

apiRequestJSONMethod · 0.80
ErrorfMethod · 0.80
ErrorMethod · 0.65

Tested by

no test coverage detected