Springboot ActiveMQ 全局配置

2017-04-25  本文已影响852人  曹振华

1 .  Gradle 依赖
compile("org.springframework.boot:spring-boot-starter-activemq")
compile("org.apache.activemq:activemq-broker")

  1. application.properties
jms.alwaysSyncSend=false&jms.useAsyncSend=true    用来设定producer(或者session)发送消息的方式:同步/异步.在brokerUrl中指定,单位:毫秒 jms.sendTimeout=30000 消息发送最大阻塞(等到ACK)时间。这个参数和syncSend方式配合使用,在同步发送方式中,send方法将会阻塞直到broker反馈ACK,不过这种阻塞的时长无法预期,我们需要使用sendTimeout来设定最大的阻塞时间,如果阻塞超时,将会抛出RequestTimedOutIOException。此值默认为0,表示永不超时
      spring.activemq.broker-url=failover:(tcp://localhost:61616,tcp://localhost:61626,tcp://localhost:61636)?initialReconnectDelay=100
      spring.activemq.user=admin
      spring.activemq.password=admin
      #broker kind to create if no broker-url is specified
      spring.activemq.in-memory=true
      # Specify if the default broker URL should be in memory. Ignored if an explicit broker has been specified.
      spring.activemq.packages.trust-all=false
      # Trust all packages.
      #spring.activemq.packages.trusted=
      # Comma-separated list of specific packages to trust (when not trusting all packages).
      #spring.activemq.pool.configuration.*= # See PooledConnectionFactory.
      spring.activemq.pool.enabled=false
      # Whether a PooledConnectionFactory should be created instead of a regular ConnectionFactory.
      spring.activemq.pool.expiry-timeout=0
      # Connection expiration timeout in milliseconds.
      spring.activemq.pool.idle-timeout=30000
      # Connection idle timeout in milliseconds.
      spring.activemq.pool.max-connections=10
      #consumer消费的最小和最大线程数
      spring.jms.listener.concurrency=10
      spring.jms.listener.max-concurrency=10
      #是否是订阅方式,true:队列;false:topic
      spring.jms.pub-sub-domain=false
      #消费端ack方式
      spring.jms.listener.acknowledge-mode=client
上一篇下一篇

猜你喜欢

热点阅读