Home > Back-end >  RocketMQMessageListener rocketmq - springboot will be invalid
RocketMQMessageListener rocketmq - springboot will be invalid

Time:09-26

Consumer code below
 
@ Component
@ RocketMQMessageListener (
Topic="topicTest",
ConsumerGroup="consumer - group"
)
Public class consumer implements RocketMQListener {

Private Logger Logger=LoggerFactory. GetLogger (getClass ());
@ Override
Public void onMessage (String s) {
Logger. The info (" [onMessage] [Thread number: {} message content: {}] ", Thread. The currentThread () getId (), s);
}
}


The producer sends a message part below
 
@ Test
Void contextLoads () {
TopicTest rocketMQTemplate. ConvertAndSend (", "" hello springboot rocketmq");
System. The out. Println (" send success ");
}

Consumers are so written, then the producer sends a message, how customers can't accept the news, what reason be
  • Related