33 Commits

Author SHA1 Message Date
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
Jean-Noël Moyne
bee172de56 Update test to use the SubjectTransforms array in StreamSource 2023-09-20 08:21:33 +02:00
Jean-Noël Moyne
78f3964975 [ADDED] Support for stream subject transform (#1200)
* Adds support for stream subject transform

Co-authored-by: Piotr Piotrowski <piotr@synadia.com>
2023-09-20 08:19:54 +02:00
Byron Ruth
fd05bbb000 [FIXED] Unset start time for ordered consumer on retry (#1341)
If an ordered consumer was configured with a start time, on
retry, the copied consumer config would start with sequence
but the existing start time opt would conflict causing
a config error.

Fix #1281

Signed-off-by: Byron Ruth <byron@nats.io>
2023-07-07 13:46:08 +02:00
Piotr Piotrowski
7c468cdaa2 Fix flaky TestJetStreamConcurrentQueueDurablePushConsumers test (#1267)
Signed-off-by: Piotr Piotrowski <piotr@synadia.com>
2023-05-19 13:19:37 +02:00
Piotr Piotrowski
d313991b62 [CHANGED] Generate consumer name in Subscribe() when name is not provided (#1261)
Signed-off-by: Piotr Piotrowski <piotr@synadia.com>
2023-05-11 16:56:10 +02:00
Tomasz Pietrek
7c72997ecc Fix TestJetStreamStreamInfoWithSubjectDetails test (#1225)
Signed-off-by: Tomasz Pietrek <tomasz@nats.io>
2023-03-01 10:24:33 +01:00
Piotr Piotrowski
c86a1a1548 Revert "[ADDED] Support for stream subject transform" (#1220)
* Revert "[ADDED] Support for stream subject transform (#1200)"

This reverts commit c8608284eb.

* Revert "js: mirror test updates"

This reverts commit 424de47b25.
2023-02-24 15:14:46 +01:00
Piotr Piotrowski
edb105cbe9 [ADDED] FetchBatch method to utilize non-blocking pull subscription requests (#1211)
Co-authored-by: Waldemar Quevedo <wally@nats.io>
2023-02-15 15:18:50 +01:00
Waldemar Quevedo
66adc124f1 Go 1.20 updates, add build tag for rand.Seed
Signed-off-by: Waldemar Quevedo <wally@nats.io>
2023-02-10 14:09:06 -08:00
Jean-Noël Moyne
c8608284eb [ADDED] Support for stream subject transform (#1200)
* Adds support for stream subject transform

Co-authored-by: Piotr Piotrowski <piotr@synadia.com>
2023-02-05 16:41:35 -08:00
Cesar V. Sampaio
7ca331ad05 chore: remove deprecated usage of "io/ioutil" (#1150) 2022-12-05 11:26:55 +01:00
Tomasz Pietrek
7ac1087d8c [CHANGED] Make lookupStreamBySubject public (#1114) 2022-10-31 16:30:55 +01:00
Piotr Piotrowski
1ee76eacf9 [CHANGED] Ordered consumer recreate on missing heartbeat (#1097) 2022-10-04 11:15:19 +02:00
jnmoyne
65796fc5ab [CHANGED] StreamInfo() will now return all subjects when requested
If a subject filter is specified in the StreamInfoRequest{} option,
then all matching subjects will be returned and not be capped to
the server limit of 100,000. It is internally using pagination
that was added in the server PR: https://github.com/nats-io/nats-server/pull/3454
2022-09-15 16:00:45 -06:00
Deepak Sah
866ce0858b [ADDED] Option to set memory storage to true for a consumer (#1078) 2022-09-15 21:12:45 +02:00
Derek Collison
f68442136d Mirrors can answer direct gets potentially so removing error condtion.
Signed-off-by: Derek Collison <derek@nats.io>
2022-09-06 07:39:37 -07:00
Ivan Kozlovic
b22f6cbc82 Add options instead of introducing new DirectGetMsg API.
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2022-07-28 19:26:56 -06:00
Ivan Kozlovic
6528169f0d [ADDED] JetStream: DirectGetMsg API
The AllowDirect boolean must be set in the stream configuration.
When that is the case, then all servers (leader and replicas) are
part of a DQ group and can respond to a "DIRECT.GET" request.

The KeyValue store makes use of the direct get when connecting
to a stream with the AllowDirect option.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2022-07-25 16:45:30 -06:00
Ivan Kozlovic
e3f6eb03d4 Updated server version and adjusted tests
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2022-04-15 19:33:47 -06:00
Waldemar Quevedo
f658a93098 Add ClientTrace struct for JS tracing
Signed-off-by: Waldemar Quevedo <wally@synadia.com>
2022-03-28 22:55:03 -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
R.I.Pienaar
2554593026 support tracing JS api calls
Signed-off-by: R.I.Pienaar <rip@devco.net>
2021-10-14 10:17:18 +02:00
Ivan Kozlovic
51d43e46a5 [FIXED] JetStream: ordered consumers handling of auto unsub
If user creates an ordered consumer and uses AutoUnsubscribe()
with the returned subscription, and if the ordered consumer was
reset (due to a gap detection), the library should resend an
UNSUB with adjusted max for the new subscription ID.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2021-10-13 13:59:40 -06:00
Ivan Kozlovic
aedc479e75 Fixed ordered consumer test
Several issues:
- We send a "EOF" empty message which should not be counted as
the number of chunks used to reconstitute the asset
- Some "message filters" that are removed as part of the execution
of the filter's callback would not be put back for the following
"sync" test (we test async then sync).

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2021-10-05 09:53:38 -06:00
Ivan Kozlovic
f3a531d051 [FIXED] Fetch() could return immediately with a timeout error
This would happen when pull requests would have filled the waiting
queue in the JetStream consumer and a 408 status was returned.

Resolves #809

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2021-09-02 08:12:36 -06:00
Ivan Kozlovic
33433c95d4 Fixed check for JS.ACK tokens count
Do not reject if it has only 11 tokens.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2021-08-25 09:57:01 -06:00
Ivan Kozlovic
5a2962709c Removed new option SubjectIsDelivery and some other changes
This is to align with newer version of the ADR describing the
subscription workflow:
- Removed option SubjectIsDelivery that was introduced in main branch
(but not released yet).
- Take into consideration the new ACK layout
- Make sure that OrderedConsumer rejects user configuring DeliverSubject

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2021-08-18 17:48:05 -06:00
Ivan Kozlovic
45b7e7725b JetStream: lot of changes
They will be described in the release notes, but gist:

Added:
- `DeliverSubject()` option to configure the deliver subject of a JetStream consumer created by the `js.Subscribe()` call (and variants)
- `BindDeliverSubject()` option to subscribe directly to a JetStream consumer deliver subject (bypassing any lookup or JetStream consumer creation)
- Fields `DeliverGroup` in `ConsumerConfig`, `PushBound` in `ConsumerInfo`. They help making prevent incorrect subscriptions to JetStream consumers
- Field `Last` in `SequencePair`

Changed:
- With a `PullSubscription`, calling `NextMsg()` or `NextMsgWithContext()` will now return `ErrTypeSubscription`. You must use the `Fetch()` API
- If the library created internally a JetStream consumer, the consumer will be deleted on `Unsubscribe()` or when the `Drain()` completes
- Fail multiple instances of a subscription on the same durable push consumer (only one active at a time). Also, consumers now have the concept of `DeliverGroup`, which is the queue group name they are created for. Only queue member from the same group can attach to this consumer, and a non queue subscription cannot attach to it. Note that this requires server v2.3.5
- Attempting to create a queue subscription with a consumer configuration that has idle heartbeats and/or flow control will now result in an error

Fixed:
- Possible lock inversion
- JetStream consumers could be incorrectly deleted on subscription's `Unsubscribe()`

Resolves #785
Resolves #776
Resolves #775
Resolves #748
Resolves #747

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2021-08-15 11:47:32 -06:00
Ivan Kozlovic
c91c1043a0 Fixed issue where JS would change subscription subject
This would cause issues during a reconnect

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2021-08-13 10:59:24 -06:00
Derek Collison
c414086daa Move actual sub back to before consumer based on feedback
Signed-off-by: Derek Collison <derek@nats.io>
2021-08-09 12:48:18 -07:00
Derek Collison
90f007b828 Ordered Consumers
This introduces ordered consumers. They are a convenience over ephemeral, no ack, no redelivery, only deliver things in strict order setups.
We have the swap out when we detect gaps and change out the underlying sub and JetStream consumer, and we process the heartbeats as well, detecting gaps at the end or if a stream or consumer is pulled out from underneath of us.

Signed-off-by: Derek Collison <derek@nats.io>
2021-08-06 13:28:53 -07:00