I am using reactor api for consuming data from reuters feed. How to specify multiple hosts in connection config?
I am using below code:
connectOptions.connectionList().add(connectInfo);
connectOptions.connectionList().get(0).connectOptions().majorVersion(Codec.majorVersion());
connectOptions.connectionList().get(0).connectOptions().minorVersion(Codec.minorVersion());
connectOptions.connectionList().get(0).connectOptions().connectionType(ConnectionTypes.SOCKET);
connectOptions.connectionList().get(0).connectOptions().unifiedNetworkInfo().address(srvrHostname);
connectOptions.connectionList().get(0).connectOptions().unifiedNetworkInfo().serviceName(srvrPortNo);
connectOptions.connectionList().get(0).connectOptions().guaranteedOutputBuffers(1000);
// Prepare our connection
//connectOptions.connectionList().add(connectInfo);
connectOptions.connectionList().get(1).connectOptions().majorVersion(Codec.majorVersion());
connectOptions.connectionList().get(1).connectOptions().minorVersion(Codec.minorVersion());
connectOptions.connectionList().get(1).connectOptions().connectionType(ConnectionTypes.SOCKET);
connectOptions.connectionList().get(1).connectOptions().unifiedNetworkInfo().address(srvrHostname2);
connectOptions.connectionList().get(1).connectOptions().unifiedNetworkInfo().serviceName(srvrPortNo);
connectOptions.connectionList().get(1).connectOptions().guaranteedOutputBuffers(1000);
After hit trial, I noticed that by uncommenting the code, I can make connection.
However, when I print host name in channel_Up or channel_ready events, It is always 2nd host i.e.
connectOptions.connectionList().get(1).connectOptions().unifiedNetworkInfo().address(srvrHostname2);
1) Is above correct way to connect using multiple hosts ?
2) I am using reconnect tries as -1, so how reactor api will be failed over to other host in pipeline?