nats-io / stan.go

NATS Streaming System
https://nats.io
Apache License 2.0
706 stars 117 forks source link

Cannot receive message published asynchronous on subscription #346

Closed sergevonage closed 3 years ago

sergevonage commented 3 years ago

I run examples from the examples folder. If I run

go run stan-pub/main.go msg hello

it works proper:

Connected to nats://127.0.0.1:4222 clusterID: [my-stan] clientID: [stan-sub]
Listening on [msg], clientID=[stan-sub], qgroup=[] durable=[]
Received a message: hello

But I run it asynchronous:

go run stan-pub/main.go -a true msg hello

I don't receive anything.

Are there some additional configuration to be subscribed for message published asynchronous?

kozlovic commented 3 years ago

This is because the command to send is wrong. It should be:

go run stan-pub/main.go -a msg hello

or

go run stan-pub/main.go -a=true msg hello

You were otherwise sending to the channel name "true". You can run the server with -SDV and see that happening.

sergevonage commented 3 years ago

Yeah, thank, sorry for misunderstanding