/
" as a level separator. For instance foo/bar
would translate to NATS subject foo.bar
. But in MQTT, /foo/bar/
is a valid subject, which, if simply translated, would become .foo.bar.
, which is NOT a valid NATS Subject./
between two levels.
foo/bar
foo.bar
/
as first level/.
/foo/bar
/.foo.bar
/
as last level./
foo/bar/
foo.bar./
/
next to another./
foo//bar
foo./.bar
/
next to another/.
//foo/bar
/./.foo.bar
.
foo.bar
foo bar
#
>
+
*
#
matches any number of levels within a topic, which means that a subscription on foo/#
would receive messages on foo/bar
, or foo/bar/baz
, but also on foo
. This is not the case in NATS where a subscription on foo.>
can receive messages on foo/bar
or foo/bar/baz
, but not on foo
. To solve this, NATS Server will create two subscriptions, one on foo.>
and one on foo
. If the MQTT subscription is simply on #
, then a single NATS subscription on >
is enough.+
matches a single level, which means foo/+
can receive message on foo/bar
or foo/baz
, but not on foo/bar/baz
nor foo
. This is the same with NATS subscriptions using the wildcard *
. Therefore foo/+
would translate to foo.*
.foo/bar
, server "A" creates a subscription on foo.bar
, which interest is propagated as any other NATS subscription. A publisher connecting anywhere in the cluster and publishing on foo.bar
would cause server "A" to deliver a QoS 0 message to the MQTT subscription.max_ack_pending
on a given session cannot exceed 65535. Attempting to create a subscription that would bring the total above the limit would result in the server returning a failure code in the SUBACK for this subscription.#
" wildcard, each subscription ending with "#
" will use 2 times the max_ack_pending
value.#
may cause the NATS server to create two subscriptions.