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.annotation.EnableJms;
  import org.springframework.jms.config.DefaultJmsListenerContainerFactory;
  
  @Configuration
  @EnableJms
  public class ReceiverConfig {
      //
      @Value("${activemq.broker-url}")
      private String brokerUrl;
  
      public ActiveMQConnectionFactory receiverActiveMQConnectionFactory(){
          ActiveMQConnectionFactory activeMQConnectionFactory = new ActiveMQConnectionFactory();
          activeMQConnectionFactory.setBrokerURL(brokerUrl);
  
          return activeMQConnectionFactory;
      }
  
      @Bean
      public DefaultJmsListenerContainerFactory jmsActivationSpecFactory(){
          //
          DefaultJmsListenerContainerFactory factory = new DefaultJmsListenerContainerFactory();
          factory.setConnectionFactory(receiverActiveMQConnectionFactory());
  
          return factory;
      }
  
      @Bean
      public Receiver receiver(){
          return new Receiver();
      }
  
  }
  