Enabling Publisher Reconnect
Enable the JMS publisher reconnect feature by defining the Broker list. You specify all the Broker Servers that you want to include in the reconnection pool in the Broker list. You can also specify the order in which the Broker Servers are chosen in the reconnection pool; sequential or random.
For JMS messaging:
Use the connectionFactory.setBrokerList property to define the Broker list.
public void setBrokerList(String brokerList) throws JMSException;
Add each Broker Server to the list using the following syntax:
[Broker Name]@<host>[:port]
Separate each entry with a comma. If there is only one Broker Server in the list, the client will attempt to reconnect with that server at pre-defined intervals. You can specify the intervals in the Java properties, com.webmethods.jms.broker.reconnectAttempts and com.webmethods.jms.reconnectDelay .
The following example shows how to create a Broker list containing two Broker Servers for JMS.
TopicConnectionFactory tcf1 = new WmTopicConnectionFactoryImpl();
((WmConnectionFactoryImpl)tcf1).setBrokerList("Broker
#1@localhost:6849,Broker #1@Tokyo:2000");
For C# messaging:
Use the IconnectionFactory.BrokerList property to define the Broker list.
public interface IConnectionFactory {
String BrokerList
{
get;
set;
}
Add each Broker Server to the list using the following syntax:
[Broker Name]@<host>[:port]
Separate each entry with a comma. When a connection is lost, the client will attempt to reconnect with the original server at pre-defined intervals. If the connection attempt fails, then it will attempt to connect to the next server in the list. You can specify the connection attempt intervals in the application configuration file (app.config).
The following example shows how to create a Broker list containing two Broker Servers for C#
IConnectionFactory cf = MSGFactory.GetConnnectionFactory(null);
cf.BrokerList = "Broker #1@localhost:6849,Broker #1@Tokyo:2000");