Commit Graph

237 Commits

Author SHA1 Message Date
Jaime Piña
994c933b84 js: Replace JetStreamManager listers with iterators 2021-03-09 15:29:29 -08:00
Waldemar Quevedo
e61aa9efa2 js: Add ReplayOriginal policy and RateLimit
Signed-off-by: Waldemar Quevedo <wally@synadia.com>
2021-03-05 22:35:48 -08:00
Waldemar Quevedo
c04f781f28 jsm: Add StreamNames and ConsumerNames
Signed-off-by: Waldemar Quevedo <wally@synadia.com>
2021-03-04 14:08:25 -08:00
Jaime Piña
171c566564 Validate ack policy for pull consumers
Signed-off-by: Waldemar Quevedo <wally@synadia.com>
2021-02-28 14:41:48 -08:00
Jaime Piña
924bd70443 Remove configurePublish from MaxWait
Add AckWait for PubOpt and SubOpt

Update tests to use AckWait instead
2021-02-28 14:41:35 -08:00
Jaime Piña
c1418b6df8 Add more JS sub opts 2021-02-28 14:41:11 -08:00
Jaime Piña
f681635fdc Add more SubOpts 2021-02-25 11:14:20 -08:00
Waldemar Quevedo
17713175b5 js: Test updates
Signed-off-by: Waldemar Quevedo <wally@synadia.com>
2021-02-24 14:57:04 -08:00
Waldemar Quevedo
cd50f85f1a js: Add QueueSubscribeSync to JS context
Signed-off-by: Waldemar Quevedo <wally@synadia.com>
2021-02-10 15:49:33 -08:00
Waldemar Quevedo
46a5ea3edf js: Handle 503 status when JS API unavailable in pull mode
Signed-off-by: Waldemar Quevedo <wally@synadia.com>
2021-02-09 17:40:22 -08:00
Waldemar Quevedo
7c44823185 js: Add GetMsg API to JetStreamManager
Signed-off-by: Waldemar Quevedo <wally@synadia.com>
2021-02-09 14:05:51 -08:00
Waldemar Quevedo
bb1d5e1c0d js: Remove PushDirect option
Now that Ack can be used by non JetStream subscriptions,
to subscriber directly it is only needed to use a regular
subscription.

Signed-off-by: Waldemar Quevedo <wally@synadia.com>
2021-02-03 09:38:05 -08:00
Waldemar Quevedo
b8a5a1fcc4 js: Cleanup of JS consumers on unsub/drain
This adds logic to the client so that some type of consumers can
be cleaned up depending on whether `Unsubscribe` or `Drain` are called:

```go
// Deletes a consumer (both ephemeral and durables)
sub.Unsubscribe()

// Does not delete a durable consumers, but ephemerals are deleted.
sub.Drain()
```

This also means that both `nc.Drain` would also clean up any
ephemeral consumer that was created, but not doing anything
to durable consumers that were created or attached.

This way in case a durable is created and then an application restarts
and reattaches to the same durable consumer, then it can still delete
the consumer that it created with `Unsubscribe` or gracefully close
using `Drain` without deleting durable consumers.

Signed-off-by: Waldemar Quevedo <wally@synadia.com>
2021-02-03 00:03:34 -08:00
Waldemar Quevedo
758fbdd947 Merge pull request #648 from nats-io/js-attach-rm
js: Make consumer attach based on durable name, remove Attach
2021-02-02 21:41:15 -08:00
Waldemar Quevedo
5a7adbce3f js: Allow Acking of JS messages without JS context
Signed-off-by: Waldemar Quevedo <wally@synadia.com>
2021-02-02 16:37:53 -08:00
Waldemar Quevedo
e4f7287f45 js: Make consumer attach based on durable name, remove Attach
Signed-off-by: Waldemar Quevedo <wally@synadia.com>
2021-02-02 12:54:35 -08:00
Waldemar Quevedo
19a62e4649 js: Add AccountInfo to JetStreamManagement
Signed-off-by: Waldemar Quevedo <wally@synadia.com>
2021-01-22 15:19:39 -08:00
Derek Collison
39676e5c18 Add in support for optional cluster info for streams and consumers.
Once this lands will update server tests to use this vs full blown JS cluster setup here.

Signed-off-by: Derek Collison <derek@nats.io>
2021-01-22 12:40:50 -08:00
Waldemar Quevedo
bddf81b175 js: Prevent sending duplicated Acks
Signed-off-by: Waldemar Quevedo <wally@synadia.com>
2021-01-21 17:04:38 -08:00
Waldemar Quevedo
f6886af9ec Make most of JS API types private
Signed-off-by: Waldemar Quevedo <wally@synadia.com>
2021-01-15 09:14:10 -08:00
Waldemar Quevedo
7221823fca Add validation for durable names
Signed-off-by: Waldemar Quevedo <wally@synadia.com>
2021-01-13 16:04:20 -08:00
Waldemar Quevedo
7356ebbde0 js: Add Subscribe option for AckPolicy
Signed-off-by: Waldemar Quevedo <wally@synadia.com>
2021-01-13 12:04:56 -08:00
Waldemar Quevedo
9355a98b33 Add DeleteMsg to JetStream management
Signed-off-by: Waldemar Quevedo <wally@synadia.com>
2021-01-12 16:57:09 -08:00
Jaime Piña
3e0aed6da7 Remove snapshot logic 2021-01-06 13:35:35 -08:00
Jaime Piña
1a29e1be4a Add more Stream and Consumer management APIs
This adds the follow APIs for Streams.
* UpdateStream
* DeleteStream
* SnapshotStream
* RestoreStream
* PurgeStream
* StreamLister

This adds the follow APIs for Consumers.
* ConsumerInfo
* ConsumerLister
* DeleteConsumer
2021-01-04 14:43:46 -08:00
Waldemar Quevedo
86a16bba8b js: Add option to configure deliver policy from consumer
Signed-off-by: Waldemar Quevedo <wally@synadia.com>
2020-12-17 17:20:57 -08:00
Waldemar Quevedo
a3519e1e54 Merge pull request #621 from wallyqs/js-interfaces-split
Separate JetStream into smaller interfaces
2020-12-16 15:56:24 -08:00
Waldemar Quevedo
8e4ec67804 js: Treat JS functional options as interfaces
This changes some of the internals of how functional options
are used so that it gives more flexibility when growing the number
of options in the client.

The API stays the same but instead of options being concrete types,
PubOpt, SubOpt and JSOpt are interfaces so that the behavior changes
depending on where an option is used.

Signed-off-by: Waldemar Quevedo <wally@synadia.com>
2020-12-11 16:43:00 -08:00
Waldemar Quevedo
c1932e104c Merge pull request #622 from wallyqs/js-golint
js: Fix a few golint errors
2020-12-11 09:43:24 -08:00
Derek Collison
94bf95aada Make file storage the default, implementation for #623
Signed-off-by: Derek Collison <derek@nats.io>
2020-12-10 20:22:22 -08:00
Waldemar Quevedo
2720565ee5 js: Fix a few golint errors
Signed-off-by: Waldemar Quevedo <wally@synadia.com>
2020-12-10 16:23:58 -08:00
Waldemar Quevedo
1c03e2bdce Separate JetStream into smaller interfaces
This separates the JetStream interface into two smaller interfaces:
A JetStream interface which is for producing and consuming messages
and a JetStreamManager interface for creating streams/consumers.

This also adds a new interface that is the compound of both called
JetStreamContext and is the one that is being returned when calling
`nc.JetStream()`.

This change allows to opt-in to the behaviors provided by the
JetStreamContext as needed, for example:

```go
// Can be used to produce/consume messages, but not for creating streams
var js nats.JetStream
js, err = nc.JetStream()

// Can be used for managing streams/consumers
var jsm nats.JetStreamManager
js, err = nc.JetStream()

// Can still be used to both create streams and publish
js, err := nc.JetStream()
```

Signed-off-by: Waldemar Quevedo <wally@synadia.com>
2020-12-09 16:28:03 -08:00
Derek Collison
948f5f80a1 Add in StreamInfo
Signed-off-by: Derek Collison <derek@nats.io>
2020-12-09 06:29:07 -08:00
Derek Collison
8424c59b41 Remove redundant check
Signed-off-by: Derek Collison <derek@nats.io>
2020-12-08 13:13:17 -08:00
Derek Collison
4dd05a834f Trying to ack a non JS msg would panic and hang
Signed-off-by: Derek Collison <derek@nats.io>
2020-12-08 13:06:23 -08:00
Derek Collison
090c71e95c Assign jsSub during low level subscription
Signed-off-by: Derek Collison <derek@nats.io>
2020-12-03 16:09:52 -08:00
Derek Collison
60de70431f JetStream API updates
Signed-off-by: Derek Collison <derek@nats.io>
2020-11-30 06:46:23 -08:00