在 Spring 引导应用程序中配置 consumerWindowSize

Configuring consumerWindowSize in Spring Boot application

ActiveMQ Artemis配置文件在Spring下面启动:

spring:
  artemis:
    host: localhost
    port: 61616
    user: admin
    password: admin123

broker-url 没有属性,因此我可以像

一样设置 consumerWindowSize
tcp://localhost:61616?consumerWindowSize=0`

如何在 Spring 引导应用程序中配置 consumerWindowSize

基于 the Spring Boot documentation (which references ArtemisProperties) I don't believe you can set the broker's actual URL or any of the properties associated with it. This is a pretty serious short-coming of the Artemis Spring Boot integration as it really limits the configuration. There is already an issue 开放(希望)解决这个问题。

添加以下配置以解决此问题:

@Bean("connectionFactory")
    public ConnectionFactory connectionFactory(AppProperties appProperties) {
        ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory($brokerUrl);
        cf.setUser($user);
        cf.setPassword($password);
        return cf;
    }