Search in sources :

Example 1 with MsgQueueProducer

use of com.jd.blockchain.consensus.mq.producer.MsgQueueProducer 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);
}
Also used : MsgQueueProducer(com.jd.blockchain.consensus.mq.producer.MsgQueueProducer) MsgQueueConsumer(com.jd.blockchain.consensus.mq.consumer.MsgQueueConsumer)

Example 2 with MsgQueueProducer

use of com.jd.blockchain.consensus.mq.producer.MsgQueueProducer 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;
}
Also used : MsgQueueProducer(com.jd.blockchain.consensus.mq.producer.MsgQueueProducer) MsgQueueConsensusSettings(com.jd.blockchain.consensus.mq.settings.MsgQueueConsensusSettings) MsgQueueConsumer(com.jd.blockchain.consensus.mq.consumer.MsgQueueConsumer) DefaultMessageTransmitter(com.jd.blockchain.consensus.mq.client.DefaultMessageTransmitter)

Aggregations

MsgQueueConsumer (com.jd.blockchain.consensus.mq.consumer.MsgQueueConsumer)2 MsgQueueProducer (com.jd.blockchain.consensus.mq.producer.MsgQueueProducer)2 DefaultMessageTransmitter (com.jd.blockchain.consensus.mq.client.DefaultMessageTransmitter)1 MsgQueueConsensusSettings (com.jd.blockchain.consensus.mq.settings.MsgQueueConsensusSettings)1