How to listen to topic using spring boot jms

前端 未结 3 1149
被撕碎了的回忆
被撕碎了的回忆 2021-01-05 07:19

I am trying to listen to topic using the below snippet. However its listening to queue by default. There is no xml config in this case. I am completely relying on annotation

3条回答
  •  梦毁少年i
    2021-01-05 07:39

    The answer marked correct is ALMOST correct. It still wont work because:

    factory.setPubSubDomain(true) 
    

    must come AFTER:

    configurer.configure(factory, connectionFactory);
    

    Otherwise the pubSubDomain flag being set to true is lost when configuring the defaults and that factory instance will still work with queues and not topics.

提交回复
热议问题