153 Commits

Author SHA1 Message Date
Waldemar Quevedo
4832d7150b [FIXED] timeoutWriter not recovering after first error (#1896)
Signed-off-by: Waldemar Quevedo <wally@nats.io>
2025-07-07 16:39:35 +02:00
Piotr Piotrowski
a06b6a92ee [IMPROVED] Move CI to github actions (#1623)
Signed-off-by: Piotr Piotrowski <piotr@synadia.com>
2024-09-05 11:12:17 +02:00
Joseph Woodward
97e6a525e9 [IMPROVED] Trim trailing slash if set on server address which causes errors during look up (#1654) 2024-07-17 15:47:48 +02:00
Piotr Piotrowski
6570ee2c8e [FIXED] Get rid of server dev dependencies in nats package (#1441)
Signed-off-by: Piotr Piotrowski <piotr@synadia.com>
Co-authored-by: masumomo <masumotomiki18@gmail.com>
2023-10-15 18:59:15 +02:00
Piotr Piotrowski
6740b1247f [ADDED] Invoke ErrorHandler on preparing connection string when reconnecting (#1397)
Signed-off-by: Piotr Piotrowski <piotr@synadia.com>
2023-09-12 08:19:58 +02:00
Paolo TETI
6b9c74529b [FIXED] typos in comments and error messages
Fixes typos in comments and error message found using codespell.
2023-08-28 21:37:35 +02:00
Piotr Piotrowski
76b92fb24f [IMPROVED] Replace empty interface with any (#1332) 2023-06-27 12:40:21 +02:00
Piotr Piotrowski
1bb385f044 Revert "[IMPROVED] Replace empty interface with any" (#1330)
This reverts commit af3706ecfd.
2023-06-22 10:52:40 +02:00
Piotr Piotrowski
61b0ce9bd4 [IMPROVED] Replace empty interface with any (#1315)
Signed-off-by: Piotr Piotrowski <piotr@synadia.com>
2023-06-14 20:19:55 +02:00
Piotr Piotrowski
d85ef5d525 Fixes after rebase
Signed-off-by: Piotr Piotrowski <piotr@synadia.com>
2023-05-23 12:08:20 +02:00
Piotr Piotrowski
8d9ad1b995 Make consumer create idempotent 2023-05-23 11:55:56 +02:00
Thomas Long
bbde3f3034 [IMPROVED] Reduce the size of the bufio.Reader for message header parsing (#1187) 2023-01-11 13:39:13 +01:00
Cesar V. Sampaio
7ca331ad05 chore: remove deprecated usage of "io/ioutil" (#1150) 2022-12-05 11:26:55 +01:00
Piotr Piotrowski
398a1ecb71 [ADDED] IgnoreAuthErrorAbort option on Connect (#1141) 2022-11-22 19:11:59 +01:00
Ivan Kozlovic
f6c1a78576 [FIXED] Trailing comma at end of URL lists should be ignored
Resolves #1056

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2022-08-30 13:25:26 -06:00
Byron Ruth
893829b0a2 Add UserJWTAndSeed helper function
The motivation for this is to support situations when
the JWT and seed are passed as environment variables or
other means that don't rely on a file.

Signed-off-by: Byron Ruth <b@devel.io>
2022-08-12 14:21:32 -04:00
Neil Alexander
92c5e2ef05 Support for in-process connections (client support for nats-io/nats-server#2360) 2022-07-30 11:23:44 +01:00
Todd Beets
06441fe061 Replaced hard-coded Sleep with channels 2022-03-25 16:06:03 -07:00
Todd Beets
e74477b1aa Streamline max connections reconnect test case 2022-03-25 15:41:13 -07:00
Todd Beets
17302cdd23 Add test case for auto reconnect on max_connections exceeded from server. 2022-03-25 14:00:14 -07:00
Ivan Kozlovic
abfa624f54 [IMPROVED] Connect error when given an invalid user creds file
The failure to connect would be "no nkey seed found". It will now
be more explicit:
```
error signing nonce: unable to extract key pair from file "myfile.creds": no nkey seed found
```

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2022-02-18 14:25:51 -07:00
Ivan Kozlovic
279ec83766 Updates based on code review
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2022-02-02 16:12:37 -07:00
Ivan Kozlovic
05a456d4de Fixed tests to run on Windows + some cleanup
- JS Servers need a special sequence on shutdown. Most of the time
the store was attempted to be removed before the server was shutdown,
which on Windows would result in an error and the next test may
recover the previous state.
- Made use of the jsClient() helper to remove typical connect+jetstream
code.
- Added some nats.Timeout() during connect so that Windows connect
to a server that is not running is faster than the default 2sec, which
may cause tests to run very long or simply fail.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2022-02-02 15:08:52 -07:00
Ivan Kozlovic
1752facb43 [IMPROVED] Websocket: use 80/443 as default ports
If no port is specified in the URL, port 80 will be used if scheme
is "ws://" and port 443 will be used if scheme is "wss://".

Resolves #876

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2022-01-07 18:18:51 -07:00
Ivan Kozlovic
eced2999ef [FIXED] Inboxes suffix would contain many zeros
This was introduced by PR https://github.com/nats-io/nats.go/pull/767
when the nuidSize was used instead of replySuffixLen to just build
the reply suffix. This meant that the suffix part with 22 characters
long and had lots of zeros at the end.

Added a test to make sure we don't break that in the future.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2021-08-31 18:32:44 -06:00
R.I.Pienaar
7d68c97c1a review feedback
Signed-off-by: R.I.Pienaar <rip@devco.net>
2021-06-29 18:39:15 +02:00
R.I.Pienaar
559051c265 support custom inbox prefixes
Signed-off-by: R.I.Pienaar <rip@devco.net>
2021-06-18 16:27:35 +02:00
Waldemar Quevedo
3f05b6aa47 Add nats.Header type based on http.Header
Currently it is case sensitive and preserves the case
without doing any normalization.

Signed-off-by: Waldemar Quevedo <wally@synadia.com>
2021-04-27 18:07:59 -07:00
Ivan Kozlovic
5bcdd3361f Create natsReader and natsWriter for a connection.
This is in preparation before adding WS support.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2021-04-23 12:26:09 -06:00
Waldemar Quevedo
bd7b51f4d0 Update handling of account authentication expired error
Signed-off-by: Waldemar Quevedo <wally@synadia.com>
2021-03-30 15:40:50 -07:00
Waldemar Quevedo
d2c2280fa6 Fix auth revoke error
Signed-off-by: Waldemar Quevedo <wally@synadia.com>
2021-03-24 19:56:14 -07:00
Derek Collison
60de70431f JetStream API updates
Signed-off-by: Derek Collison <derek@nats.io>
2020-11-30 06:46:23 -08:00
R.I.Pienaar
93be3c8e71 Merge pull request #609 from ripienaar/606
ensure response message goes to the reply subject in RespondMsg
2020-11-16 18:04:59 +01:00
R.I.Pienaar
41eef2a5be ensure response message goes to the reply subject in RespondMsg
Signed-off-by: R.I.Pienaar <rip@devco.net>
2020-11-16 15:52:39 +01:00
Derek Collison
b9917b8e17 Changes to default pending and default error handler.
Slow consumer state still seems off, this is a first step trying to improve.
Increased the default number of pending messages limit but kept bytes the same.

Also introduced a default ErrHandler that will print out to stderr in case none has been set.

Signed-off-by: Derek Collison <derek@nats.io>
2020-11-15 11:06:26 -08:00
R.I.Pienaar
1044b72a6b expose additional info line information to the client
Signed-off-by: R.I.Pienaar <rip@devco.net>
2020-11-11 16:12:03 +01:00
Derek Collison
643f27b895 Check description in test
Signed-off-by: Derek Collison <derek@nats.io>
2020-10-21 07:27:11 -07:00
Derek Collison
7ce305ab0b Add support for status line plus description
Signed-off-by: Derek Collison <derek@nats.io>
2020-10-20 17:30:41 -07:00
R.I.Pienaar
8c8e1e9644 remove DeliverySubject from the public ConsumerConfig
Signed-off-by: R.I.Pienaar <rip@devco.net>
2020-10-12 10:43:57 +02:00
R.I.Pienaar
a08c0a0959 unexport various things copied from jsm
Signed-off-by: R.I.Pienaar <rip@devco.net>
2020-10-12 10:43:57 +02:00
R.I.Pienaar
8b08268553 Allow the Subscribe functions to access JetStream consumers
Signed-off-by: R.I.Pienaar <rip@devco.net>
2020-10-08 10:30:10 +02:00
Matthias Hanel
5c3369f827 Removing dependency on jwt
Signed-off-by: Matthias Hanel <mh@synadia.com>
2020-06-01 13:59:23 -04:00
Matthias Hanel
73e0d83dd9 Picking up jwt2 branch of jwt and nats-server 2020-06-01 12:57:04 -04:00
Ivan Kozlovic
8fb3769283 [ADDED] LameDuckModeHandler option/setter
This will be invoked when the server enters LDM mode.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2020-05-29 09:47:33 -06:00
Derek Collison
974ef22aa1 Cleanup header decoding
Signed-off-by: Derek Collison <derek@nats.io>
2020-05-27 23:03:28 -07:00
Ivan Kozlovic
1b0a85aad4 Merge pull request #564 from nats-io/fix_563
[FIXED] Added jitter in the reconnect logic
2020-05-13 16:32:39 -06:00
Ivan Kozlovic
1b2a2d61c7 Shuffle but leave first URL in place
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2020-05-06 15:34:22 -06:00
Ivan Kozlovic
a5c7af3ad8 [FIXED] Randomize discovered server URLs if allowed
After adding discovered URLs from the INFO, reshuffle the pool
if option allows

Resolves #565

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2020-05-06 11:24:23 -06:00
Ivan Kozlovic
2431048550 [FIXED] Added jitter in the reconnect logic
-Add ReconnectJitter option setter allowing user to set jitter
 for non and TLS connections (possibly different values)
-Default for non-TLS will be 100ms and TLS 1sec
-Add a CustomReconnectDelay handler that is passed the number
 of full url lists attempts. The user callback will then return
 a duration that is going to be used for the wait. It is the
 responsibility of the user to send a delay with some jitter
 if desired.

Resolves #563

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2020-05-06 09:07:05 -06:00
Derek Collison
661cce1e84 Added in support for client IP from the server and RTT calculation
Signed-off-by: Derek Collison <derek@nats.io>
2020-04-26 14:09:28 -07:00