SetPendingLimits sets the limits for pending msgs and bytes for this subscription. Zero is not allowed. Any negative value means that the given metric is not limited.
(msgLimit, bytesLimit int)
| 5663 | // SetPendingLimits sets the limits for pending msgs and bytes for this subscription. |
| 5664 | // Zero is not allowed. Any negative value means that the given metric is not limited. |
| 5665 | func (s *Subscription) SetPendingLimits(msgLimit, bytesLimit int) error { |
| 5666 | if s == nil { |
| 5667 | return ErrBadSubscription |
| 5668 | } |
| 5669 | s.mu.Lock() |
| 5670 | defer s.mu.Unlock() |
| 5671 | if s.conn == nil || s.closed { |
| 5672 | return ErrBadSubscription |
| 5673 | } |
| 5674 | if s.typ == ChanSubscription { |
| 5675 | return ErrTypeSubscription |
| 5676 | } |
| 5677 | if msgLimit == 0 || bytesLimit == 0 { |
| 5678 | return ErrInvalidArg |
| 5679 | } |
| 5680 | s.pMsgsLimit, s.pBytesLimit = msgLimit, bytesLimit |
| 5681 | return nil |
| 5682 | } |
| 5683 | |
| 5684 | // Delivered returns the number of delivered messages for this subscription. |
| 5685 | func (s *Subscription) Delivered() (int64, error) { |
no outgoing calls