content: package com.urunov.activemq.jms;
  
  import org.apache.activemq.ActiveMQConnectionFactory;
  import org.springframework.beans.factory.annotation.Value;
  import org.springframework.context.annotation.Bean;
  import org.springframework.context.annotation.Configuration;
  import org.springframework.jms.connection.CachingConnectionFactory;
  import org.springframework.jms.core.JmsTemplate;
  
  @Configuration
  public class SenderConfigure  {
      //
      @Value("${activemq.broker-url}")
      private String brokerUrl;
  
      public ActiveMQConnectionFactory senderActiveMQConnectionFactory() {
          ActiveMQConnectionFactory activeMQConnectionFactory = new ActiveMQConnectionFactory();
  
          activeMQConnectionFactory.setBrokerURL(brokerUrl);
  
          return activeMQConnectionFactory;
      }
  
      @Bean
      public CachingConnectionFactory cachingConnectionFactory(){
          return new CachingConnectionFactory(senderActiveMQConnectionFactory());
      }
  
      @Bean
      public JmsTemplate jmsTemplate(){
          return new JmsTemplate(cachingConnectionFactory());
      }
  
      @Bean
      public Sender sender(){
          return new Sender();
      }
  }
  