Topic replication
You can use topic replication to ensure that the structure of the topic tree, topic definitions, and topic data are synchronized between servers.
- Servers with topic replication enabled for a section of the topic tree share information about that section of the topic tree through the datagrid. The topic information and topic data are synchronized on all the servers.
- A new topic is created on one server in the replicated section of the topic tree.
- The new topic is replicated on the other servers with identical topic information. When its topic data is updated on the first server, that data is replicated on the other servers.
Considerations
Consider the following factors when using topic replication:
- Only publishing topics can be replicated.
- Any topic that is part of a replicated branch of the topic tree and is not one of the supported types of topic is not replicated. Instead that topic path remains unbound.
- Only topic-wide messages are replicated. Messages sent to a single client or to all clients except one are not replicated.
- Replication of topic information into the datagrid is not automatic. It must be configured at the server. This gives a performance advantage, as you can choose which parts of your topic tree to replicate.
- Updates to a particular topic will always be delivered to all subscribers in the same order. However, delivery order is not guaranteed across different topics. For example, if you update topic 1 then topic 2, some subscribers might receive the update to topic 2 before the update to topic 1.
- Replication of topic data can impact performance.
- When using topic replication, it is recommended that the max-depth of the queue defined for the connector used by replication is set to 2 times the expected topic tree size. When a server disconnects and then reconnects, the entire topic tree needs to be replicated. As a result 1 or 2 messages are en-queued per topic (1 if the topic has no value, 2 if it does). The element to be adjusted is the one inside the Connectors.xml under the largeQueue configuration, as this is the one used for the replicating servers' sessions.