DefaultJmsListenerContainer using BeanFactoryPostProcessor

不羁的心 提交于 2020-03-04 23:04:28

问题


I am currently trying to support dynamic multiple jms provider scenario in my application. So far I did achieved to create DefaultMessageListenerContainer using post processor. Cool part is that the DefaultMessageContainerListener has destinationName property where you can easily set the queue to be listened/sent for messages.

However, the DefaultJmsListenerContainerFactory has no such method to set the queue name. I do reached at around the SimpleJmsListenerEndpoint that the DefaultJmsListenerContainerFactory using to initiate the container. But I am unable to find how to set it. Please see below what I did so far.

beanDefinitionRegistry.registerBeanDefinition("messageListenerContainer", 
    BeanDefinitionBuilder.rootBeanDefinition(DefaultJmsListenerContainerFactory.class)
                         .addPropertyReference("connectionFactory", "queueConnectionFactory")
                         .addPropertyReference("destinationResolver", "jndiDestinationResolver")
                         .addPropertyValue("concurrency", concurrency)
                         .addPropertyValue("sessionAcknowledgeMode", Session.AUTO_ACKNOWLEDGE)
                         .getBeanDefinition()
);

But as you can see I can not set the queue endpoint for listening. How can I do that from here?

来源:https://stackoverflow.com/questions/59734256/defaultjmslistenercontainer-using-beanfactorypostprocessor

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!