Comments (5)
Thanks for the detailed report!
We will take a look soon.
from nats.go.
@mihaitodor there were 2 issues:
- The
Watch("\"001.>\"")
was a server issue, fixed here: nats-io/nats-server#5318 Watch("")
returned wrong error due to lacking client-side validation: #1613
Both will now return an error since both are essentially invalid arguments: nats: invalid key: keys cannot be empty and must be a valid NATS subject
.
from nats.go.
That's awesome, thank you very much for the quick fixes!
from nats.go.
Both PRs are merged and will be included in the next releases of nats-server and nats.go.
from nats.go.
Update: I also investigated switching to the new github.com/nats-io/nats.go/jetstream
API and I can still reproduce the issue with the following code:
package main
import (
"context"
"log"
"time"
"github.com/nats-io/nats.go"
"github.com/nats-io/nats.go/jetstream"
)
func main() {
conn, err := nats.Connect("localhost:4222")
if err != nil {
log.Fatal(err)
}
js, err := jetstream.New(conn)
if err != nil {
log.Fatal(err)
}
kv, err := js.KeyValue(context.Background(), "foobar")
if err != nil {
log.Fatal(err)
}
// watcher, err := kv.Watch(ctx, "001.>")
watcher, err := kv.Watch(context.Background(), "\"001.>\"")
if err != nil {
log.Fatal(err)
}
defer func() {
if err := watcher.Stop(); err != nil {
log.Fatal(err)
}
}()
var keys []any
ctx, done := context.WithTimeout(context.Background(), 3*time.Second)
defer done()
loop:
for {
select {
case entry := <-watcher.Updates():
if entry == nil {
break loop
}
keys = append(keys, entry.Key())
case <-ctx.Done():
log.Fatal("timeout")
}
}
log.Printf("%v", keys)
}
I can, however, now pass a context to kv.Watch()
which makes it easier to abort after a while, but I still think the kv.Watch()
call should reject invalid keys.
Also, the nats: jetstream not enabled
error is still returned for kv.Watch(context.Background(), "")
.
from nats.go.
Related Issues (20)
- Panic when creating jet stream consumer on wildcard stream HOT 8
- Add checks for empty response in JetStream API calls HOT 2
- Object store publishes chunks without using domain in subject HOT 4
- add new encoder interface with less allocations HOT 4
- Memory leak in readMIMEHeader HOT 4
- add `FetchContext` FetchOpt
- Add `KeysWithFilter` methods to KV interface HOT 3
- panic: interface conversion: jetstream.Consumer is nil, not *jetstream.pullConsumer HOT 1
- jetstream.PublishMsgAsync panic
- Using Fetch() with and OrderedConsumer and a delivery policy of DeliverLastPerSubjectPolicy returns incorrect results HOT 1
- Publish RetryAttempt and RetryWait not working as expected HOT 9
- Client logs unmarshal errors HOT 9
- Make JS Consumer deletion on Unsubscribe() / Drain() optional HOT 1
- JetStream ConsumerContext `Drain` function not waiting for in flight requests to be done processing HOT 6
- NEW NATS API Drain for durable consumer HOT 15
- Micro does not register service with Nats. HOT 1
- `PublishAsync` Retry Mechanism Not Working as Expected HOT 5
- Failed to create OrderedConsumer HOT 6
- packets lost: subscribe to more topics and get message packets quickly. The first message packet of some topics is lost. HOT 4
- How to get the number of active user subscriptions for the current topic, not consumers
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nats.go.