in rocketmq-v5-client-spring-boot/src/main/java/org/apache/rocketmq/client/autoconfigure/ExtConsumerResetConfiguration.java [84:107]
private void registerTemplate(String beanName, Object bean) {
Class<?> clazz = AopProxyUtils.ultimateTargetClass(bean);
if (!RocketMQClientTemplate.class.isAssignableFrom(bean.getClass())) {
throw new IllegalStateException(clazz + " is not instance of " + RocketMQClientTemplate.class.getName());
}
org.apache.rocketmq.client.annotation.ExtConsumerResetConfiguration annotation = clazz.getAnnotation(org.apache.rocketmq.client.annotation.ExtConsumerResetConfiguration.class);
GenericApplicationContext genericApplicationContext = (GenericApplicationContext) applicationContext;
validate(annotation, genericApplicationContext);
SimpleConsumerBuilder consumerBuilder = null;
SimpleConsumer simpleConsumer = null;
try {
consumerBuilder = createConsumer(annotation);
simpleConsumer = consumerBuilder.build();
} catch (Exception e) {
log.error("Failed to startup SimpleConsumer for RocketMQTemplate {}", beanName, e);
}
RocketMQClientTemplate rocketMQTemplate = (RocketMQClientTemplate) bean;
rocketMQTemplate.setSimpleConsumerBuilder(consumerBuilder);
rocketMQTemplate.setSimpleConsumer(simpleConsumer);
rocketMQTemplate.setMessageConverter(rocketMQMessageConverter.getMessageConverter());
log.info("Set real simpleConsumer to :{} {}", beanName, annotation.value());
}