Activemq使用连接池

  • ConnectionFactory 配置
  // mq#producer
    @Bean
    public ConnectionFactory jmsConnectionFactory() {
        ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(url);
        connectionFactory.setUseAsyncSend(true);

        PooledConnectionFactory factory = new PooledConnectionFactory(connectionFactory);
        factory.setMaxConnections(20);
        factory.setMaximumActiveSessionPerConnection(500);
        return factory;
    }
  • pom配置
        <dependency>
            <groupId>org.apache.activemq</groupId>
            <artifactId>activemq-client</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.activemq</groupId>
            <artifactId>activemq-pool</artifactId>
        </dependency>
  • spring boot配置
spring.activemq.pool.enabled=true
展开阅读全文

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 大白 设计师: CSDN官方博客
应支付0元
点击重新获取
扫码支付

支付成功即可阅读