如何使用嵌入式 ActiveMQ Artemis 为 Spring 引导配置最大传送尝试次数?

How to config max-delivery-attempts for Spring Boot with Embedded ActiveMQ Artemis?

我想按照the manual中的描述配置死信的max-delivery-attempts

我试过 ,但不知道如何设置 max-delivery-attempts 值。

调试 Configuration 实例后,我终于找到了方法。这是代码:

@Configuration
public class RedeliveryConfiguration implements ArtemisConfigurationCustomizer {

    @Override
    public void customize(org.apache.activemq.artemis.core.config.Configuration configuration) {
        Map<String, AddressSettings> addressesSettings = configuration.getAddressesSettings();

        // # is the catch all address or default address
        addressesSettings.get("#").setMaxDeliveryAttempts(2);
    }
}