Is it possible to configure a jmsTemplate Topic publisher and also a Queue message producer in the same springboot application

330 Views Asked by At

My application is using a Queue Originally, So I need to also Implement a Topic for the same application. I'm having difficulties setting up the configurations. please help guys

1

There are 1 best solutions below

1
On BEST ANSWER

Just define two JmsTemplate beans

    @Bean
    public JmsTemplate jmsTemplate(ConnectionFactory connectionFactory) {
        JmsTemplate template = new JmsTemplate(connectionFactory);
        template.setPubSubDomain(false);
        return template;
    }

    @Bean
    public JmsTemplate jmsTemplatePubSub(ConnectionFactory connectionFactory) {
        JmsTemplate template = new JmsTemplate(connectionFactory);
        template.setPubSubDomain(true);
        return template;
    }

This will prevent Boot from declaring its own template