Search in sources :

Example 1 with MsgQueueServerSettings

use of com.jd.blockchain.consensus.mq.settings.MsgQueueServerSettings 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;
}
Also used : NodeSettings(com.jd.blockchain.consensus.NodeSettings) MsgQueueNodeSettings(com.jd.blockchain.consensus.mq.settings.MsgQueueNodeSettings) MsgQueueConsensusSettings(com.jd.blockchain.consensus.mq.settings.MsgQueueConsensusSettings) MsgQueueServerConfig(com.jd.blockchain.consensus.mq.config.MsgQueueServerConfig) MsgQueueServerSettings(com.jd.blockchain.consensus.mq.settings.MsgQueueServerSettings) MsgQueueNodeConfig(com.jd.blockchain.consensus.mq.config.MsgQueueNodeConfig) MsgQueueNodeSettings(com.jd.blockchain.consensus.mq.settings.MsgQueueNodeSettings)

Aggregations

NodeSettings (com.jd.blockchain.consensus.NodeSettings)1 MsgQueueNodeConfig (com.jd.blockchain.consensus.mq.config.MsgQueueNodeConfig)1 MsgQueueServerConfig (com.jd.blockchain.consensus.mq.config.MsgQueueServerConfig)1 MsgQueueConsensusSettings (com.jd.blockchain.consensus.mq.settings.MsgQueueConsensusSettings)1 MsgQueueNodeSettings (com.jd.blockchain.consensus.mq.settings.MsgQueueNodeSettings)1 MsgQueueServerSettings (com.jd.blockchain.consensus.mq.settings.MsgQueueServerSettings)1