Universal Messaging 10.3 | Concepts | Performance, Scalability and Resilience | Horizontal Scalability | URL Syntax for Horizontal Scalability
 
URL Syntax for Horizontal Scalability
In order to enable the HS feature, you provide a URL with HS-Syntax instead of the standard RNAME URL syntax (see the section Client Connection for comparison).
The format of a horizontal scalability URL for both individual servers and clusters is bound by a set of parentheses - "(" and ")". The same syntax is used for both UM native sessions and JMS connections factories.
Examples of Horizontal Scalability URL Syntax
1. (UM1)(UM2)(UM3)(UM4) - Indicates 4 standalone realms, namely UM1, UM2, UM3 and UM4. In this case, 4 physical connections will be constructed and maintained underneath a single nSession and thus a JMS Connection.
2. (UM1,UM2)(UM3,UM4) - Indicates 2 clusters, one consisting of UM1 and UM2 and the other consisting of UM3 and UM4. In this case, 2 physical connections will be constructed and maintained.
3. (UM1)(UM2,UM3)(UM4) - Indicates one cluster consisting of UM2 and UM3, and two standalone realms, namely UM1 and UM4. In this case, 3 physical connections will be constructed and maintained.
For the URL syntax, the following rules apply:
1. Each set of parentheses must contain at least one valid connection URL.
2. There is no API imposed limit on the number of sets of parentheses in the URL. However there are resource limitations that must be considered.
3. Each set of parentheses indicates a unique physical connection, and the realm names within each set of parentheses will be supplied unchanged to the underlying implementation.
Example for UM Native API
// Connect to UM servers on hosts: host1, host2, host3 and host4.
// The server on host3 and host4 are configured in a cluster
nSessionAttributes sessionAttributes = new nSessionAttributes(
"(nsp://host1:9000)(nsp://host2:9000)(nsp://host3:9000,nsp://host4:9000)");
nSession hsSession = nSessionFactory.create(sessionAttributes);
hsSession.init();

//Create a channel on all nodes in the HS set
nChannelAttributes nca = new nChannelAttributes("myChannel");
nca.setClusterWide(true);
nChannel channel = hsSession.createChannel(nca);
Example for JMS API:
// Create a connection factory which connects to the UM servers
// on hosts: host1, host2, host3 and host4.
// The server on host3 and host4 are configured in a cluster

//com.pcbsys.nirvana.nJMS.ConnectionFactoryImpl
ConnectionFactoryImpl conFac = new ConnectionFactoryImpl(
"(nsp://host1:9000)(nsp://host2:9000)(nsp://host3:9000,nsp://host4:9000)");
Connection connection = conFac.createConnection();
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
//Create a queue on all nodes in the HS set
session.createQueue("myQueue");