Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package net.krg.kneip;
- import org.apache.activemq.ActiveMQConnectionFactory;
- import org.apache.activemq.camel.component.ActiveMQComponent;
- import org.apache.activemq.pool.PooledConnectionFactory;
- import org.apache.camel.component.jms.JmsConfiguration;
- import org.springframework.context.annotation.Bean;
- import org.springframework.context.annotation.Configuration;
- @Configuration
- public class AppConfig {
- @Bean
- public ApplicationContextProvider applicationContextProvider(){
- ApplicationContextProvider applicationContextProvider = new ApplicationContextProvider();
- return applicationContextProvider;
- }
- @Bean
- public ActiveMQConnectionFactory jmsConnectionFactory(){
- ActiveMQConnectionFactory jmsConnectionFactory = new ActiveMQConnectionFactory();
- jmsConnectionFactory.setBrokerURL("tcp://localhost:61616");
- return jmsConnectionFactory;
- }
- @Bean
- public PooledConnectionFactory pooledConnectionFactory(){
- PooledConnectionFactory pooledConnectionFactory = new PooledConnectionFactory();
- pooledConnectionFactory.setConnectionFactory(jmsConnectionFactory());
- pooledConnectionFactory.setMaxConnections(8);
- return pooledConnectionFactory;
- }
- @Bean
- public JmsConfiguration jmsConfig(){
- JmsConfiguration jmsConfig = new JmsConfiguration();
- jmsConfig.setConnectionFactory(pooledConnectionFactory());
- jmsConfig.setConcurrentConsumers(10);
- return jmsConfig;
- }
- @Bean
- public ActiveMQComponent activeMq(){
- ActiveMQComponent activeMq = new ActiveMQComponent();
- activeMq.setConfiguration(jmsConfig());
- return activeMq;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement