Configuring fan-out
Configure the the Diffusion™ server to act as a client to one or more other Diffusion servers and replicate topics from those servers.
Use the fanout section of the Server.xml configuration files to define client connections for this secondary server to make to one or more primary servers and the topics on those primary servers to replicate locally.
<fanout> <connection> <url>ws://primary_server_hostname:8080</url> <principal>client</principal> <password>password</password> <retry-delay>1000</retry-delay> <reconnect-timeout>60s</reconnect-timeout> <recovery-buffer-size>1024</recovery-buffer-size> <input-buffer-size>1024k</input-buffer-size> <output-buffer-size>1024k</output-buffer-size> <link><selector>?topic_path//</selector></link> </connection> </fanout>
Connection
Use the url element to specify the URL of the primary server and the transport and port used for the connection.
Permissions
When connecting to another Diffusion server as a client, this secondary server can provide a principal and associated password. If a principal is not provided, the secondary server connects anonymously
To subscribe to topics on the primary server and replicate them locally, the secondary server's client session must have the
and permissions for those topics. Ensure that the principal this secondary server uses is assigned a role with the appropriate permissions on the primary server. If the secondary server connects anonymously to the primary server, ensure anonymous sessions on the primary server are assigned the appropriate permissions.Reconnection
Use the retry-delay element to specify the time in milliseconds between the connection or reconnection attempts that the secondary server makes to the primary server.
Use the reconnect-timeout element to specify the maximum time in milliseconds that the secondary server will attempt to reconnect to its existing session on the primary server after a disconnection. If this element is not specified, a value of 0 is assumed and reconnection is not attempted.
If the secondary server is configured to attempt to reconnect, it keeps a buffer of messages sent to the primary server. Use the recovery-buffer-size element to configure the size of this buffer.
Replicating topics
Each fanout-connection has one or more link elements. Each link element uses a topic selector to specify a set of topics on the primary server to replicate on this secondary server.
- Avoid using regular expressions in the selectors you use to configure when setting up fan-out links on the secondary server. Topic selectors containing regular expressions increase the likelihood of false negatives and false positives when propagating missing topic notifications.
- Ensure that the principal that the secondary server uses to make the fan-out connection to the primary server has the permission for the path prefix of the selector that triggered the missing topic notification.
Configuring your primary server
The primary server in a fan-out configuration must be configured to handle serving the topics replicated by fan-out to the secondary server or servers.
<queue-definition>depth</queue-definition>
To allow the secondary server to reconnect, enable reconnection on the connector that the primary server uses to accept connections from the secondary server or servers. Ensure that the reconnection timeout (keep-alive) value for the connector is long enough to allow the secondary server time to reconnect. Set the maximum queue depth and recovery buffer sizes to values that are appropriate to the volume of messages you expect to occur between the primary and secondary servers.
For more information, see Connectors.xml.