When using RocketMQ, during the service startup process, the Consumer consumes messages when the service is not started.

Original link: https://www.lifengdi.com/archives/article/3888

Background When we use RocketMQ, the @PostConstruct annotation is generally used for Consumer startup. (@PostConstruct: used to execute methods that need to be executed after dependency injection is performed when performing any initialization.), or use bean configuration. The configuration is as follows: Producer configuration Configure all producers in the configuration class, inject and use them in the business, and bind the start and destruction of producers to the initialization and destruction of beans: @Configuration public class MQProducerConfig { // The first production by @Bean(initMethod = “start[…]

This article is reproduced from: https://www.lifengdi.com/archives/article/3888
This site is for inclusion only, and the copyright belongs to the original author.

Leave a Comment