I am new to Spring JMS. My application is developed using Spring Boot and is deployed in JBoss EAP 7.2.0. I have a remote queue which is an ActiveMQ Artemis queue which is also embedded within JBoss EAP 7.2.0. Can anyone please suggest me how to send a message to the remote JMS queue using JmsTemplate of Spring Boot? Basically I am not getting how should I define the remote ConnectionFactory to connect to the remote queue.
  spring.jms.jndi-name=java:/<your connection factory name for artemis>
   <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-artemis</artifactId>
   </dependency>
@Component
public class MyMessageSender {
        @Autowired
        JmsTemplate jmsTemplate;
        public void send(String msg){
                jmsTemplate.convertAndSend("my.queue.name", msg);
        }
}
    @Bean // Serialize message content to json using TextMessage
    public MessageConverter jacksonJmsMessageConverter() {
        MappingJackson2MessageConverter converter = new MappingJackson2MessageConverter();
        converter.setTargetType(MessageType.TEXT);
        converter.setTypeIdPropertyName("_type");
        return converter;
    }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With