use of com.jd.blockchain.consensus.mq.config.MsgQueueServerConfig in project jdchain-core by blockchain-jd-com.
the class MsgQueueNodeServerFactory method buildServerSettings.
@Override
public MsgQueueServerSettings buildServerSettings(String realmName, ConsensusViewSettings viewSettings, String nodeAddress, SSLSecurity sslSecurity, Properties properties) {
if (!(viewSettings instanceof MsgQueueConsensusSettings)) {
throw new IllegalArgumentException("ConsensusSettings data isn't supported! Accept MsgQueueConsensusSettings only!");
}
int id = -1;
for (NodeSettings nodeSettings : viewSettings.getNodes()) {
MsgQueueNodeSettings settings = (MsgQueueNodeSettings) nodeSettings;
if (settings.getAddress().equals(nodeAddress)) {
id = settings.getId();
break;
}
}
MsgQueueNodeSettings nodeSettings = new MsgQueueNodeConfig().setAddress(nodeAddress).setId(id);
MsgQueueServerSettings serverSettings = new MsgQueueServerConfig().setRealmName(realmName).setNodeSettings(nodeSettings).setConsensusSettings((MsgQueueConsensusSettings) viewSettings);
return serverSettings;
}
Aggregations