* [ADDED] Configuration field for msg counters
Signed-off-by: Piotr Piotrowski <piotr@synadia.com>
* [ADDED] NoHeaders option for GetMsg
Signed-off-by: Piotr Piotrowski <piotr@synadia.com>
* [ADDED] NoHeaders option for GetLastMsgForSubject
Signed-off-by: Piotr Piotrowski <piotr@synadia.com>
---------
Signed-off-by: Piotr Piotrowski <piotr@synadia.com>
Add a new NamePrefix field to OrderedConsumerConfig that allows users
to specify custom prefixes for ordered consumer names. When provided,
consumer names will be generated as {NamePrefix}_{sequence_number}
(e.g., "myapp_1", "myapp_2"). If not provided, the default behavior
of using a NUID as prefix is maintained.
Signed-off-by: Piotr Piotrowski <piotr@synadia.com>
* Add timeout support to MessagesContext.Next() with mutual exclusion
* [ADDED] FetchContext support for pull consumer operations
---------
Signed-off-by: Piotr Piotrowski <piotr@synadia.com>
* [IMPROVED] De-flake TestHotSpotReconnect
Signed-off-by: Piotr Piotrowski <piotr@synadia.com>
* Fixed failing per key ttl test
Signed-off-by: Piotr Piotrowski <piotr@synadia.com>
---------
Signed-off-by: Piotr Piotrowski <piotr@synadia.com>
When UpdateStream is used with domain-configured mirrors or sources,
the domain prefix is now properly preserved by converting domains
to external configurations consistently with CreateStream.
Fixes#1744
Signed-off-by: Piotr Piotrowski <piotr@synadia.com>
The client should continue to try to reconnect following the
reconnection logic settings when running into account limit
error changes.
Signed-off-by: Waldemar Quevedo <wally@nats.io>
Use consumer pending count from creation time instead of first message
delta to fix race where concurrent updates could cause duplicate keys
during listing operations.
Signed-off-by: Piotr Piotrowski <piotr@synadia.com>
When creating or updating a stream, the sources in the server response
will not be ordered, but the current code assumes so. The commit
removes that assumption.
Fixes#1906
* [FIXED] nit: return a more appropriate error
* Fix error in UpdateStream()
Signed-off-by: Piotr Piotrowski <piotr@synadia.com>
---------
Signed-off-by: Piotr Piotrowski <piotr@synadia.com>
Co-authored-by: Piotr Piotrowski <piotr@synadia.com>
Adds ability to configure pending message/byte limits on service endpoints
to handle slow consumers gracefully.
* Add WithEndpointPendingLimits() option for endpoint configuration
* Support message count and/or byte limits (-1 for no limit)
* Enhanced NATSError with error wrapping support for proper error chains
Signed-off-by: Piotr Piotrowski <piotr@synadia.com>
Make ClientTrace field publicly accessible through Options() method.
Returns a copy to maintain read-only contract.
Signed-off-by: Piotr Piotrowski <piotr@synadia.com>
* [ADDED] Channel-based Error() method to KeyLister and KeyWatcher interfaces
The new Error() method returns <-chan error, enabling concurrent error
handling with select statements. This allows immediate detection of
timeout errors during key listing/watching operations.
Signed-off-by: Piotr Piotrowski <piotr@synadia.com>
* Returned closed err channel if watcher is nil
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
---------
Signed-off-by: Piotr Piotrowski <piotr@synadia.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Allows passing JWT and seed credentials as byte slices instead of file paths.
Mirrors UserCredentials() but accepts bytes directly. Supports both separate
JWT/seed bytes and chained credential format.
Fixes#1873
Signed-off-by: Piotr Piotrowski <piotr@synadia.com>
Co-authored-by: AsyncLegs <noreply@github.com>
* [FIXED] JetStream consumer hanging after connection closure
Fixes#1875
JetStream consumer operations would hang indefinitely after server
shutdown or connection closure.
Changes:
- Fixed core NATS closed handler bug for ChanSubscription and SyncSubscription
- Added ErrConnectionClosed error for better error context
- Enhanced Consume() to report connection closure via ConsumeErrHandler
- Improved Next() to wrap ErrMsgIteratorClosed with ErrConnectionClosed
Both Messages().Next() and consumer.Consume() now properly handle connection
closure and provide appropriate error reporting to applications.
Signed-off-by: Piotr Piotrowski <piotr@synadia.com>
* Fix consume not sending conn closed error, improve tests
Signed-off-by: Piotr Piotrowski <piotr@synadia.com>
---------
Signed-off-by: Piotr Piotrowski <piotr@synadia.com>