Skip to content

docs: clarify when topics are created automatically #42

Description

@sword2ya

As the document says, topic will be created on first use by subscribing.

 Topics are created on first use by publishing to the named topic or by subscribing to a channel on the named topic. Channels are created on first use by subscribing to the named channel.

but it does not.

my environments are as below:

# nsqd -version
nsqd v1.0.1-alpha (built w/go1.10)
# nsqlookupd -version
nsqlookupd v1.0.1-alpha (built w/go1.10)
# nsq_tail -version
nsq_tail v1.0.1-alpha
# nsqadmin -version
nsqadmin v1.0.1-alpha (built w/go1.10)

what did I do?

started nsqd , nsqlookupd and nsqadmin using default params.

then i subscribed a topic to two channels by nsq_tail:

nsq_tail --channel=c1 --topic=test --lookupd-http-address=localhost:4161
nsq_tail --channel=c2 --topic=test --lookupd-http-address=localhost:4161

then I visit http://localhost:4171/, but i saw no topics there.

after that, I published a message on topic test by to_nsq:

# to_nsq -nsqd-tcp-address=localhost:4150 -topic=test -rate=1
2018/10/24 15:48:12 Throttling messages rate to max:1/second
{}
2018/10/24 15:48:14 INF    1 (localhost:4150) connecting to nsq

after about 40 second, the c1 received the message, but c2 didn't.

here is the output of nsq_tail:

c1:

nsq_tail --channel=c1 --topic=test --lookupd-http-address=localhost:4161 
2018/10/24 15:47:53 Adding consumer for topic: test
2018/10/24 15:47:53 INF    1 [test/c1] querying nsqlookupd http://localhost:4161/lookup?topic=test
2018/10/24 15:47:53 ERR    1 [test/c1] error querying nsqlookupd (http://localhost:4161/lookup?topic=test) - got response 404 Not Found "{\"message\":\"TOPIC_NOT_FOUND\"}"
2018/10/24 15:48:58 INF    1 [test/c1] querying nsqlookupd http://localhost:4161/lookup?topic=test
2018/10/24 15:48:58 INF    1 [test/c1] (anjiawei-Vostro-3667:4150) connecting to nsqd
{}
2018/10/24 15:49:58 INF    1 [test/c1] querying nsqlookupd http://localhost:4161/lookup?topic=test

c2:

nsq_tail --channel=c2 --topic=test --lookupd-http-address=localhost:4161
2018/10/24 15:48:04 Adding consumer for topic: test
2018/10/24 15:48:04 INF    1 [test/c2] querying nsqlookupd http://localhost:4161/lookup?topic=test
2018/10/24 15:48:04 ERR    1 [test/c2] error querying nsqlookupd (http://localhost:4161/lookup?topic=test) - got response 404 Not Found "{\"message\":\"TOPIC_NOT_FOUND\"}"
2018/10/24 15:49:14 INF    1 [test/c2] querying nsqlookupd http://localhost:4161/lookup?topic=test
2018/10/24 15:49:14 INF    1 [test/c2] (anjiawei-Vostro-3667:4150) connecting to nsqd
2018/10/24 15:50:14 INF    1 [test/c2] querying nsqlookupd http://localhost:4161/lookup?topic=test

is it a bug ? i expected to create the topic on subscribing, and i expected to receive messages on publishing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions