Commit Graph

37 Commits

Author SHA1 Message Date
Piotr Piotrowski
d6eaa84a03 [ADDED] Creating iterators for sync subscriptions (#1728)
Signed-off-by: Piotr Piotrowski <piotr@synadia.com>
2024-12-17 15:06:23 +01:00
Piotr Piotrowski
94fa0cb994 Deprecate encoded connections (#1674)
Signed-off-by: Piotr Piotrowski <piotr@synadia.com>
2024-07-23 16:46:25 +02:00
Piotr Piotrowski
b868e2a2d6 Update dates in licence headers (#1445)
Signed-off-by: Piotr Piotrowski <piotr@synadia.com>
2023-10-17 18:44:27 +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
cda50b9b31 Add simplified JetStream API with pull consumer 2023-04-25 12:10:48 +02:00
Derek Collison
11b678285e Make prefix aware creation of inbox public.
This would have been useful for example I worked on that needed multiple replies.

Signed-off-by: Derek Collison <derek@nats.io>
2022-09-10 09:57:46 -07:00
Waldemar Quevedo
944c1f1a44 Fix race with async INFO and header APIs with context
Signed-off-by: Waldemar Quevedo <wally@nats.io>
2022-03-25 14:53:56 -07:00
Phil Pennock
bf1b00513e Spelling fixes, mostly comments
The new `gospel` tool, <https://github.com/kortschak/gospel>, uses hunspell
libraries but pre-registers as acceptable words every symbol from the Go
source, massively reducing the noise and making comment spell-checking a
tractable problem.  It recently gained support for a `.words` file located in
the same directory as the `go.mod` file, to define local words.  With this, we
can fix real issues too.

This PR reduces the complaints down to 4:
 1. A reference to `syncSubscribers` which I can't figure out
 2. A reference to a `pubArg`
 3. Two references to `splitArgs`.

I made two actual code changes:
 1. Fixing a **non-exported** const type for consistency with all the others:
    `apiStreamList` -> `apiStreamListT`.
 2. Changing an error message to refer to a field which exist

Lots of typo fixes; references to since-renamed fields; etc.

A reference to `PublishAsynMsg` might have been intended to be
`PublishAsyncMsg` but that doesn't exist either, so I removed it.
Similarly, `SubjectIsDelivery` lived briefly but a stale reference was left in
a comment, so I removed that.

To reproduce:

    go install github.com/kortschak/gospel@latest
    gospel .
2022-02-05 21:26:46 -05: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
cfef5e6c50 Reworked PullSubscribe implementation
Use a SyncSubscription instead. The only visible change from the
user is that calling Fetch() after Unsubscribe() returns ErrBadSubscription
instead of timeout or context deadline exceeded, which makes more
sense to me. This is the only test that I had to tweak.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2021-08-09 17:59:00 -06:00
Waldemar Quevedo
12dcab3a4e Use newInbox in oldRequestWithContext 2021-08-03 09:57:08 -07: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
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
585eab747f Support for no responders err on requests
Signed-off-by: Derek Collison <derek@nats.io>
2020-06-17 18:15:45 -07:00
R.I.Pienaar
c4ab892f58 add support for Requests using a Msg
Signed-off-by: R.I.Pienaar <rip@devco.net>
2020-06-03 12:05:06 +02:00
Derek Collison
d5ed91cb92 Simplify request, allow for mux subject to change
Signed-off-by: Derek Collison <derek@nats.io>
2019-10-08 14:56:32 -07:00
Ivan Kozlovic
3aedf875c5 Made a function that returns appropriate error on NextMsg failure
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2019-07-12 11:21:54 -06:00
Ivan Kozlovic
f3bebb626c [FIXED] Wrong error returned in NextMsg and NextMsgWithContext
If the application is in NextMsg() (or NextMsgWithContext()) and
the subscription is unsubscribed from a different go routine, the
NextMsg() call would return that the connection is closed, instead
of the subscription.

Resolves #404

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2019-07-12 09:53:00 -06:00
Derek Collison
df59787a1a Changed approach to always set type in low level subscribe
Signed-off-by: Derek Collison <derek@nats.io>
2019-03-14 13:13:48 -07:00
Derek Collison
24fe9ab48a Added FlushWithContext(), fixes #431
Signed-off-by: Derek Collison <derek@nats.io>
2019-02-21 14:20:13 -08:00
Derek Collison
9b7fc5fe4b Improve NextMsg() performance when msg available
Signed-off-by: Derek Collison <derek@nats.io>
2019-02-21 11:53:04 -08:00
Derek Collison
7d901ef636 Make new resp init function
Signed-off-by: Derek Collison <derek@nats.io>
2018-11-04 07:13:42 -08:00
Derek Collison
139a6ac5e0 Faster and smaller reply suffix
Signed-off-by: Derek Collison <derek@nats.io>
2018-11-03 12:44:10 -07:00
Waldemar Quevedo
ccf165c2b9 Remove select and just check if context canceled
Signed-off-by: Waldemar Quevedo <wally@synadia.com>
2018-08-26 08:51:41 -07:00
Waldemar Quevedo
dc5dcc7970 Check if context canceled before waiting for Msg
Context can be used to cancel blocking waiting for a message, and in
the case that the context has already been canceled it is expected for
it to return right away since the context no longer valid.

Previous behavior was not deterministic since it was possible for a
client to still receive a messages even though the context was already
canceled.  In order to fix this, now we check first whether the
context has been canceled previous to waiting for the message to
prevent successfully making requests with invalid contexts.

Signed-off-by: Waldemar Quevedo <wally@synadia.com>
2018-08-25 19:55:44 -07:00
Derek Collison
2f0e8883ae CNCF, move to Apache 2 2018-03-17 13:36:48 -07:00
Tyler Treat
301a5b11ef Reduce locking around respSub 2017-06-06 10:54:39 -05:00
Tyler Treat
fc8a243776 Cleanup channel map on RequestWithContext timeout 2017-06-06 10:54:25 -05:00
Tyler Treat
c83b1128a8 Address CR feedback and missed RequestWithContext 2017-06-06 10:26:42 -05:00
Derek Collison
74eb51c143 New style response handler for RequestWithContext 2017-05-26 09:06:07 -07:00
Waldemar Quevedo
ebdfa4bc58 Add ErrInvalidContext check for when context is nil 2017-05-11 12:22:55 -07:00
Waldemar Quevedo
855d5bf98b Remove calling panic in client on nil Context 2017-05-11 09:57:49 -07:00
Waldemar Quevedo
183e43650e Add more tests to context cancellation 2017-05-11 09:57:49 -07:00
Waldemar Quevedo
580b6381e2 Separate validation checks from NextMsg into function
Add processNextMsgDelivered and reuse in NextMsg
2017-05-11 09:57:49 -07:00
Waldemar Quevedo
02343ff279 Add RequestWithContext API using context.Context
Add context aware APIs based on original ones

Rename prefix from context tests

Add context integration to encoded requests
2017-05-11 09:57:49 -07:00