GithubHelp home page GithubHelp logo

Can't get messages in JS mode about natscli HOT 11 CLOSED

nats-io avatar nats-io commented on June 19, 2024
Can't get messages in JS mode

from natscli.

Comments (11)

ripienaar avatar ripienaar commented on June 19, 2024

Please show stream info of the stream listening on that subject?

check error on js.Subscribe()

from natscli.

boskiv avatar boskiv commented on June 19, 2024

Thanks @ripienaar .
I did not eve create a stream.
Do you know what FATA[0000] nats: filtered consumer not unique on workqueue stream means ?
I tried to change a name in code, but it does not help

from natscli.

ripienaar avatar ripienaar commented on June 19, 2024

What language do you ise

from natscli.

boskiv avatar boskiv commented on June 19, 2024

Golang.
looks like as nats-io/nats.js#461

from natscli.

boskiv avatar boskiv commented on June 19, 2024

I got this error when second consumer starting

from natscli.

ripienaar avatar ripienaar commented on June 19, 2024

The clients have some unintended consequences where it makes consumers for you. Probably what happens is the 2nd one tries to make a new consumer rather than attach to existing.

Maybe if you share the code @wallyqs can help

from natscli.

boskiv avatar boskiv commented on June 19, 2024
func (n Nats) Init()  {
	log.Info("NATS init")
	// Connect Options.
	opts := []nats.Option{nats.Name("NATS Sample Subscriber 2")}
	opts = setupConnOptions(opts)

	// Connect to NATS
	nc, err := nats.Connect(n.Host, opts...)
	if err != nil {
		log.Fatal(err)
	}

	// Create JetStream Context
	js, _ := nc.JetStream(nats.PublishAsyncMaxPending(256))


	// Simple Async Ephemeral Consumer
	_, err = js.Subscribe("NATS.Positions", func(m *nats.Msg) {
		fmt.Printf("Received a JetStream message: %s\n", string(m.Data))
	})
	if err != nil {
		log.Fatal(err)
	}

	if err := nc.LastError(); err != nil {
		log.Fatal(err)
	}

	log.Printf("Listening on [%s]", PositionTopic)
	runtime.Goexit()
}

from natscli.

boskiv avatar boskiv commented on June 19, 2024

But I want to start a new second consumer and balance messages inside a stream between 2 and more consumers. As I expected in WorkQueue stream type

from natscli.

ripienaar avatar ripienaar commented on June 19, 2024

You should instead have 1 consumer and connect many clients to it.

from natscli.

boskiv avatar boskiv commented on June 19, 2024

Do you have some example maybe in github ?

from natscli.

ripienaar avatar ripienaar commented on June 19, 2024

Closing this, perhaps ask in slack or on the client you use discussions or something, it's not really CLI related I think.

from natscli.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.