Commit Graph

219 Commits

Author SHA1 Message Date
Ivan Kozlovic
ea036d7532 Merge pull request #710 from wallyqs/godoc-context-example
Add godoc example for JS context functions
2021-05-03 12:42:53 -06:00
Ivan Kozlovic
1667213f01 Merge pull request #724 from nats-io/js_fix_shared_channel
Fixed SubscribeSync that could possibly share channel across 2 subs
2021-04-30 09:15:38 -06:00
Waldemar Quevedo
37f9684092 js: Add sub for PullSubscribe for fetch requests
Signed-off-by: Waldemar Quevedo <wally@synadia.com>
2021-04-29 21:36:09 -07:00
Ivan Kozlovic
92272d3f21 Fixed SubscribeSync that could possibly share channel across 2 subs
Also added missing subscription's lock when setting some fields
at the end of initialization.

Fixed some flappers and missing defers.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2021-04-29 16:18:13 -06: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
Waldemar Quevedo
5a6cad0ca7 js: Fixes to parallel creation of durable consumers
Signed-off-by: Waldemar Quevedo <wally@synadia.com>
2021-04-21 16:36:55 -07:00
Waldemar Quevedo
1aefcb51d1 js: Fix issue with concurrent queue subscribers creating consumer
Signed-off-by: Waldemar Quevedo <wally@synadia.com>
2021-04-17 10:42:53 -07:00
Waldemar Quevedo
e7b6eda230 Add godoc example for JS context functions
Signed-off-by: Waldemar Quevedo <wally@synadia.com>
2021-04-12 14:00:04 -07:00
Waldemar Quevedo
1645e080ca Add consumer to msg Metadata
Signed-off-by: Waldemar Quevedo <wally@synadia.com>
2021-04-12 12:49:23 -07:00
Waldemar Quevedo
6f01c1e172 js: Add godoc examples for JetStream context
Signed-off-by: Waldemar Quevedo <wally@synadia.com>
2021-04-01 15:12:51 -07:00
Waldemar Quevedo
458d7de338 Merge pull request #696 from nats-io/js-meta-rename
js: Renaming of msg metadata fields
2021-04-01 06:46:28 -07:00
Waldemar Quevedo
a28b16eaa1 js: Renaming of msg metadata fields
Signed-off-by: Waldemar Quevedo <wally@synadia.com>

- Add SequencePair to MsgMetadata

Signed-off-by: Waldemar Quevedo <wally@synadia.com>
2021-03-31 21:57:50 -07:00
Waldemar Quevedo
f42e6f27d9 js: PubAckFuture as interface
Signed-off-by: Waldemar Quevedo <wally@synadia.com>
2021-03-31 12:14:30 -07:00
Waldemar Quevedo
1b16e34671 js: Add support for FlowControl and Heartbeats
Signed-off-by: Waldemar Quevedo <wally@synadia.com>
2021-03-30 23:52:16 -07:00
Waldemar Quevedo
c43363623d js: Add AckOpts for msg.Ack()
Signed-off-by: Waldemar Quevedo <wally@synadia.com>
2021-03-30 13:27:20 -07:00
Waldemar Quevedo
bd0fb9d1e9 js: Fix ChanSubscribe acting as SubscribeSync
Signed-off-by: Waldemar Quevedo <wally@synadia.com>
2021-03-30 10:32:26 -07:00
Jaime Piña
077cf107c9 Make Durable mandatory for PullSubscribe
nats.Durable is a SubOpt that may be passed to PullSubscribe or other
methods. If a durable name isn't passed to PullSubscribe, then we return
a runtime error.

Instead of returning a runtime error for this case, this change updates
the PullSubscribe method to require a durable name parameter.
2021-03-29 16:35:51 -07:00
Ivan Kozlovic
d9ad37db5c Merge pull request #687 from nats-io/godoc
Update API doc
2021-03-29 15:55:53 -06:00
Derek Collison
f48fc6d498 Only place onto chan when creating it.
Signed-off-by: Derek Collison <derek@nats.io>
2021-03-29 13:40:48 -07:00
Derek Collison
282c8b1fea Remove direct from merge
Signed-off-by: Derek Collison <derek@nats.io>
2021-03-29 13:23:06 -07:00
Derek Collison
67ee642087 Fix for merge
Signed-off-by: Derek Collison <derek@nats.io>
2021-03-29 13:18:11 -07:00
Derek Collison
9df112cc6d Merge branch 'master' into async_pub 2021-03-29 13:13:38 -07:00
Derek Collison
8e7cef1c9e Updates based on PR feedback.
1. Done() -> Ok()
2. Async replies have _INBOX prefix versus custom for permissions.

Signed-off-by: Derek Collison <derek@nats.io>
2021-03-29 12:30:03 -07:00
Jaime Piña
e74a7b1a08 Update API doc 2021-03-29 10:21:01 -07:00
Derek Collison
e0f259ad57 Fixes for error changes
Signed-off-by: Derek Collison <derek@nats.io>
2021-03-27 13:42:07 -07:00
Derek Collison
a1da5ef42f Add ability to do async publish to JetStream.
Signed-off-by: Derek Collison <derek@nats.io>
2021-03-27 11:28:20 -07:00
Waldemar Quevedo
2539a87825 js: remove DirectOnly JS Option
Signed-off-by: Waldemar Quevedo <wally@synadia.com>
2021-03-27 10:46:36 -07:00
Waldemar Quevedo
ff187e9737 js: Use old request style for sub.Fetch(1)
Signed-off-by: Waldemar Quevedo <wally@synadia.com>
2021-03-24 23:59:16 -07:00
Waldemar Quevedo
11e6d91a1a js: Add option to consume from Streams that are mirrors or sourced
Signed-off-by: Waldemar Quevedo <wally@synadia.com>
Signed-off-by: Jaime Piña <jaime@synadia.com>
2021-03-17 21:24:30 -07:00
Waldemar Quevedo
ac8b51a3ab js: Add js.PullSubscribe and sub.Fetch APIs for pull consumers
Signed-off-by: Waldemar Quevedo <wally@synadia.com>
2021-03-17 19:09:54 -07:00
Jaime Piña
4b55d1367f Update JetStreamManager to accept JSOpts 2021-03-11 13:06:24 -08:00
Jaime Piña
127790fcc6 Create jsOpts 2021-03-10 16:01:15 -08:00
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