如何将 broker-url 与其参数分开(ActiveMQ Artemis + Spring Boot)

How to separate broker-url from its parameters (ActiveMQ Artemis + Spring Boot)

我有一个 application.yml 文件,其中包含一个 broker-url 参数

artemis:
  broker-url: "tcp://localhost:61616?consumerWindowSize=1048576&ha=true&retryInterval=100&retryIntervalMultiplier=1.5&maxRetryInterval=60000&reconnectAttempts=10000"

我的问题是如何将 tcp://localhost:61616 部分与 ?consumerWindowSize=1048576&ha=true&retryInterval=100&retryIntervalMultiplier=1.5&maxRetryInterval=60000&reconnectAttempts=10000"

分开

更新编号1我的项目布局

更新编号2

所以,我想要的是这样的东西

ActiveMQJMSConnectionFactory f =
 new ActiveMQJMSConnectionFactory(brokerUrl + ":" +brokerPort + brokerParams);

并且我通过像这样改变我的 application.yml 取得了成就

artemis:
  broker-url: "tcp://localhost"
  broker-port: "61616"
  broker-params: "?consumerWindowSize=1048576&ha=true&retryInterval=100"

注意:我正在使用 spring boot 2.4.0

现在我可以这样调用我的 jar 神器了

   java myjar.jar --broker-params="?consumerWindowSize=1048576" --broker-port="1111" --broker-url="tcp://192.168.1.2"

无法将 URL 参数与 URL 参数分开。事实上,URL 的全部意义在于将所有东西放在一起。

ActiveMQ Artemis properties for Spring Boot allow to set host, port and other parameters only using the broker-url 属性.

您可以尝试使用 a placeholder 作为解决方法。