Advertisement
Guest User

Untitled

a guest
Apr 19th, 2013
646
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.58 KB | None | 0 0
  1. package net.krg.kneip;
  2.  
  3. import org.apache.activemq.ActiveMQConnectionFactory;
  4. import org.apache.activemq.camel.component.ActiveMQComponent;
  5. import org.apache.activemq.pool.PooledConnectionFactory;
  6. import org.apache.camel.component.jms.JmsConfiguration;
  7. import org.springframework.context.annotation.Bean;
  8. import org.springframework.context.annotation.Configuration;
  9.  
  10. @Configuration
  11. public class AppConfig {
  12.    
  13.     @Bean
  14.     public ApplicationContextProvider applicationContextProvider(){
  15.         ApplicationContextProvider applicationContextProvider = new ApplicationContextProvider();
  16.         return applicationContextProvider;     
  17.     }
  18.    
  19.     @Bean
  20.     public ActiveMQConnectionFactory jmsConnectionFactory(){
  21.         ActiveMQConnectionFactory jmsConnectionFactory =  new ActiveMQConnectionFactory();
  22.         jmsConnectionFactory.setBrokerURL("tcp://localhost:61616");
  23.         return  jmsConnectionFactory;
  24.     }
  25.    
  26.     @Bean
  27.     public PooledConnectionFactory pooledConnectionFactory(){
  28.         PooledConnectionFactory pooledConnectionFactory = new PooledConnectionFactory();
  29.         pooledConnectionFactory.setConnectionFactory(jmsConnectionFactory());
  30.         pooledConnectionFactory.setMaxConnections(8);
  31.         return pooledConnectionFactory;
  32.     }
  33.    
  34.     @Bean
  35.     public JmsConfiguration jmsConfig(){
  36.         JmsConfiguration jmsConfig = new JmsConfiguration();
  37.         jmsConfig.setConnectionFactory(pooledConnectionFactory());
  38.         jmsConfig.setConcurrentConsumers(10);
  39.         return jmsConfig;      
  40.     }
  41.    
  42.     @Bean
  43.     public ActiveMQComponent activeMq(){
  44.         ActiveMQComponent activeMq = new ActiveMQComponent();
  45.         activeMq.setConfiguration(jmsConfig());
  46.         return activeMq;
  47.     }
  48.  
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement