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 .
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#785Resolves#776Resolves#775Resolves#748Resolves#747
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
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>
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>
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>