// Module included in the following assemblies:
//
// assembly-brokered-address-types.adoc

[id='con-brokered-topic-{context}']
= Topic
// !brokered.address.topic.shortDescription:A publish-and-subscribe address with store-and-forward semantics
// !brokered.address.topic.longDescription:start
The topic address type supports the publish-subscribe messaging pattern in which there are 1..N producers and 1..M consumers. Each message published to a topic address is forwarded to all subscribers for that address. A subscriber can also be durable, in which case messages are kept until the subscriber has acknowledged them.
// !brokered.address.topic.longDescription:stop


== Hierarchical topics and wildcards

A client receiving from a topic address can specify a wildcard address with the topic address as the root. The wildcard behavior follows the MQTT syntax:

* `/` is a separator
* `+` matches one level
* `#` matches one or more levels

So, for example:

* `a/#/b` matches `a/foo/b`, `a/bar/b`, `a/foo/bar/b`

* `a/+/b` matches `a/foo/b` and `a/bar/b`, but would not match `a/foo/bar`

== Known issue with creating a subscriber on a hierarchical topic

A known issue exists where creating a subscriber on a hierarchical topic in {ProductName} causes the broker to instead create it as a competing consumer (handling the address like a queue rather than a topic). For more information about the specific workaround for your client, see the applicable client example section in link:{BookUrlBase}{BaseProductVersion}{BookNameUrl}#assembly-connecting-applications-messaging[Connecting applications to {ProductName}].

