This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Apr 19th, 2013  |  syntax: Java  |  size: 1.58 KB  |  views: 85  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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. }
clone this paste RAW Paste Data