Advertisement
Guest User

Untitled

a guest
Aug 19th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory;
  2. import org.springframework.beans.factory.annotation.Value;
  3. import org.springframework.context.annotation.Bean;
  4. import org.springframework.context.annotation.Configuration;
  5. import org.springframework.jms.connection.CachingConnectionFactory;
  6. import org.springframework.jms.core.JmsTemplate;
  7.  
  8. @Configuration
  9. public class SenderConfig {
  10.  
  11. @Value("${artemis.broker-url}")
  12. private String brokerUrl;
  13.  
  14. @Bean
  15. public ActiveMQConnectionFactory senderActiveMQConnectionFactory() {
  16. return new ActiveMQConnectionFactory(brokerUrl);
  17. }
  18.  
  19. @Bean
  20. public CachingConnectionFactory cachingConnectionFactory() {
  21. return new CachingConnectionFactory(
  22. senderActiveMQConnectionFactory());
  23. }
  24.  
  25. @Bean
  26. public JmsTemplate jmsTemplate() {
  27. return new JmsTemplate(cachingConnectionFactory());
  28. }
  29.  
  30. @Bean
  31. public Sender sender() {
  32. return new Sender();
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement