18.15.3.4. コア API のディスカバリー設定
コア API を使用して
Copy to Clipboard
Copied!
Toggle word wrap
Toggle overflow
setter メソッド
ClientSessionFactory
インスタンスを直接インスタンス化する場合は、セッションファクトリーの作成時に直接ディスカバリーグループパラメーターを指定できます。
final String groupAddress = "231.7.7.7"; final int groupPort = 9876; ServerLocator factory = HornetQClient.createServerLocatorWithHA(new DiscoveryGroupConfiguration(groupAddress, groupPort, new UDPBroadcastGroupConfiguration(groupAddress, groupPort, null, -1)))); ClientSessionFactory factory = locator.createSessionFactory(); ClientSession session1 = factory.createSession(); ClientSession session2 = factory.createSession();
final String groupAddress = "231.7.7.7";
final int groupPort = 9876;
ServerLocator factory = HornetQClient.createServerLocatorWithHA(new DiscoveryGroupConfiguration(groupAddress, groupPort, new UDPBroadcastGroupConfiguration(groupAddress, groupPort, null, -1))));
ClientSessionFactory factory = locator.createSessionFactory();
ClientSession session1 = factory.createSession();
ClientSession session2 = factory.createSession();
setDiscoveryRefreshTimeout()
を使用して、refresh-timeout
属性のデフォルト値を DiscoveryGroupConfiguration に設定できます。セッションファクトリーがセッションを作成する前に、特定期間待機するために DiscoveryGroupConfiguration で setDiscoveryInitialWaitTimeout()
を使用できます。