use of com.jd.blockchain.consensus.mq.consumer.MsgQueueConsumer in project jdchain-core by blockchain-jd-com.
the class MsgQueueConsensusClient method init.
public void init() {
String server = msgQueueNetworkSettings.getServer();
String txTopic = msgQueueNetworkSettings.getTxTopic();
String txResultTopic = msgQueueNetworkSettings.getTxResultTopic();
String msgTopic = msgQueueNetworkSettings.getMsgTopic();
String msgResultTopic = msgQueueNetworkSettings.getMsgResultTopic();
MsgQueueProducer txProducer = MsgQueueFactory.newProducer(server, txTopic, false);
MsgQueueProducer msgProducer = MsgQueueFactory.newProducer(server, msgTopic, false);
MsgQueueConsumer txResultConsumer = MsgQueueFactory.newConsumer(server, txResultTopic, false);
MsgQueueConsumer msgResultConsumer = MsgQueueFactory.newConsumer(server, msgResultTopic, false);
transmitter = new DefaultMessageTransmitter().setTxProducer(txProducer).setMsgProducer(msgProducer).setTxResultConsumer(txResultConsumer).setMsgResultConsumer(msgResultConsumer);
}
use of com.jd.blockchain.consensus.mq.consumer.MsgQueueConsumer in project jdchain-core by blockchain-jd-com.
the class ParticipantManagerService4MQ method createMQClient.
private DefaultMessageTransmitter createMQClient(ParticipantContext context) throws Exception {
MsgQueueConsensusSettings consensusSettings = (MsgQueueConsensusSettings) getConsensusSetting(context);
String server = consensusSettings.getNetworkSettings().getServer();
String txTopic = consensusSettings.getNetworkSettings().getTxTopic();
String txResultTopic = consensusSettings.getNetworkSettings().getTxResultTopic();
String msgTopic = consensusSettings.getNetworkSettings().getMsgTopic();
String msgResultTopic = consensusSettings.getNetworkSettings().getMsgResultTopic();
MsgQueueProducer txProducer = MsgQueueFactory.newProducer(server, txTopic, false);
MsgQueueConsumer txResultConsumer = MsgQueueFactory.newConsumer(server, txResultTopic, false);
MsgQueueProducer msgProducer = MsgQueueFactory.newProducer(server, msgTopic, false);
MsgQueueConsumer msgResultConsumer = MsgQueueFactory.newConsumer(server, msgResultTopic, false);
DefaultMessageTransmitter transmitter = new DefaultMessageTransmitter().setTxProducer(txProducer).setTxResultConsumer(txResultConsumer).setMsgProducer(msgProducer).setMsgResultConsumer(msgResultConsumer);
transmitter.connect();
return transmitter;
}
use of com.jd.blockchain.consensus.mq.consumer.MsgQueueConsumer in project jdchain-core by blockchain-jd-com.
the class ParticipantManagerService4MQ method initBlockQueue.
/**
* 初始化区块队列
*
* @param context
* @param nodeId
* @throws Exception
*/
private void initBlockQueue(ParticipantContext context, int nodeId) throws Exception {
MsgQueueConsensusSettings consensusSettings = (MsgQueueConsensusSettings) getConsensusSetting(context);
String server = consensusSettings.getNetworkSettings().getServer();
String blockTopic = consensusSettings.getNetworkSettings().getBlockTopic();
MsgQueueConsumer blockConsumer = MsgQueueFactory.newConsumer(nodeId, server, blockTopic, true);
blockConsumer.connect(null);
blockConsumer.start();
blockConsumer.close();
}
Aggregations