use of org.apache.rocketmq.spring.starter.core.DefaultRocketMQListenerContainer in project rocketmq-externals by apache.
the class RocketMQAutoConfigurationTests method listenerContainer.
@Test
public void listenerContainer() {
load(false, "spring.rocketmq.nameServer=127.0.0.1:9876");
BeanDefinitionBuilder beanBuilder = BeanDefinitionBuilder.rootBeanDefinition(MyListener.class);
this.context.registerBeanDefinition("myListener", beanBuilder.getBeanDefinition());
this.context.refresh();
assertThat(this.context.getBeansOfType(DefaultRocketMQListenerContainer.class)).isNotEmpty();
assertThat(this.context.containsBean(DefaultRocketMQListenerContainer.class.getName() + "_1")).isTrue();
DefaultRocketMQListenerContainer listenerContainer = this.context.getBean(DefaultRocketMQListenerContainer.class.getName() + "_1", DefaultRocketMQListenerContainer.class);
ObjectMapper objectMapper = this.context.getBean("rocketMQMessageObjectMapper", ObjectMapper.class);
assertThat(listenerContainer.getObjectMapper()).isEqualTo(objectMapper);
assertThat(listenerContainer.getConsumeMode()).isEqualTo(ConsumeMode.CONCURRENTLY);
assertThat(listenerContainer.getSelectorType()).isEqualTo(SelectorType.TAG);
assertThat(listenerContainer.getSelectorExpress()).isEqualTo("*");
assertThat(listenerContainer.getConsumerGroup()).isEqualTo(TEST_CONSUMER_GROUP);
assertThat(listenerContainer.getTopic()).isEqualTo(TEST_TOPIC);
assertThat(listenerContainer.getNameServer()).isEqualTo("127.0.0.1:9876");
assertThat(listenerContainer.getMessageModel()).isEqualTo(MessageModel.CLUSTERING);
assertThat(listenerContainer.getConsumeThreadMax()).isEqualTo(1);
}
Aggregations