java—topicjmslistenercontainerfactory是否支持异步处理—azure spring jms?

gorkyyrv  于 2021-06-26  发布在  Java
关注(0)|答案(0)|浏览(281)

我正在尝试从azure服务总线主题异步读取消息。我已经基于ms文档创建了jms侦听器

@JmsListener(destination = TOPIC_NAME, containerFactory = "topicJmsListenerContainerFactory",
            subscription = SUBSCRIPTION_NAME)
    public void receiveMessage(User user) {
        logger.info("Received message: {}", user.getName());
    }

我需要确保topicjmslistenercontainerfactory容器工厂是否支持异步处理?
spring文档说

我尝试像下面那样实现defaultjmslistenercontainerfactory,但是通过使用它,我无法从服务总线top获取任何消息。它引发了一个异常,无法找到消息传递实体。我可以使用topicjmslistenercontainerfactory容器工厂获取消息

@Bean
@ConditionalOnMissingBean(name = "jmsListenerContainerFactory")
public DefaultJmsListenerContainerFactory jmsListenerContainerFactory(DefaultJmsListenerContainerFactoryConfigurer Configure, ConnectionFactory connectionFactory) {
    DefaultJmsListenerContainerFactory factory = new DefaultJmsListenerContainerFactory();
    Configure.configure(factory, connectionFactory);
    return factory;
}

参考文献:
https://docs.microsoft.com/en-us/azure/developer/java/spring-framework/configure-spring-boot-starter-java-app-with-azure-service-bus
如何在SpringBoot中创建defaultmessagelistenercontainer?
https://docs.microsoft.com/en-us/java/api/com.azure.spring.autoconfigure.jms.servicebusjmsautoconfiguration.topicjmslistenercontainerfactory?view=azure-java-preview
https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/jms/annotation/jmslistener.html
有人能给我建议吗?

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题