RocketMQ中的start()和shutdown
时间: 2019-07-22来源:开源中国
前景提要
HDC调试需求开发(15万预算),能者速来!>>>
通常生产者 生产完消息需要shutdown吗,还是让它一直开着。
producer我是通过@Bean拿到的。拿出时,已经start()过了。 @RequestMapping ( value = "/produceMessage" , method = RequestMethod. POST ) public GeneralResponseDto produceMessage ( @RequestBody JSONObject json) throws InterruptedException , RemotingException , MQClientException , MQBrokerException { Message message = new Message() ; message.setBody(json.toJSONString().getBytes()) ; message.setTopic( "spring-demo" ) ; message.setTags( "a" ) ; DefaultMQProducer producer = producerConfig .getRocketMQProducer() ; producer.send(message) ; logger .info( "MQ 发送消息: {}" , json.toJSONString()) ; producer.shutdown(); return GeneralResponseDto. addSuccess () ; }

科技资讯:

科技学院:

科技百科:

科技书籍:

网站大全:

软件大全:

热门排行