The English version of quarkus.io is the official project site. Translated sites are community supported on a best-effort basis.

AMQP的开发服务

当运行测试时,AMQP的开发服务会在开发模式下自动启动一个AMQP 1.0代理。所以,你不需要手动启动代理。应用程序会自动配置。

启用/禁用AMQP的开发服务

AMQP的开发服务是自动启用的,除非:

  • quarkus.amqp.devservices.enabled 被设置为 false

  • amqp-hostamqp-port 已配置

  • 所有的Reactive Messaging AMQP通道都设置了 hostport 属性

AMQP的开发服务依赖于Docker来启动代理。如果你的环境不支持Docker,你将需要手动启动代理,或者连接到一个已经运行的代理。你可以使用 amqp-host , amqp-port , amqp-useramqp-password 属性来配置代理访问。

共享的代理

大多数情况下,你需要在应用程序之间共享代理。AMQP的开发服务为在 开发 模式下运行的多个Quarkus应用程序实现了一个 服务发现 机制,来共享一个代理。

AMQP的开发服务使用 quarkus-dev-service-amqp 标签来启动容器,该标签用于识别容器。

如果你需要多个(共享的)代理,你可以配置 quarkus.amqp.devservices.service-name 属性,并指定代理的名字。它会查找一个具有同样值的容器,如果找不到,就会启动一个新的容器。默认的服务名称是 amqp

在开发模式下,默认启用共享,但在测试模式下禁用共享。你可以使用 quarkus.amqp.devservices.shared=false 来禁用共享。

设置端口

默认情况下,AMQP的开发服务会选择一个随机端口,并配置应用程序。您可以通过配置 quarkus.amqp.devservices.port 属性来设置端口。

配置镜像

AMQP的开发服务使用 activemq-artemis-broker 镜像。你可以使用 quarkus.amqp.devservices.image-name 属性来配置镜像和版本:

quarkus.amqp.devservices.image-name=quay.io/artemiscloud/activemq-artemis-broker:latest
The configured image must be compatible with the activemq-artemis-broker one. The container is launched with the AMQ_USER, AMQ_PASSWORD and AMQ_EXTRA_ARGS environment variables. The ports 5672 and 8161 (web console) are exposed.

Configuration reference

Configuration property fixed at build time - All other configuration properties are overridable at runtime

Configuration property

类型

默认

If Dev Services for AMQP has been explicitly enabled or disabled. Dev Services are generally enabled by default, unless there is an existing configuration present. For AMQP, Dev Services starts a broker unless amqp-host or amqp-port are set or if all the Reactive Messaging AMQP channel are configured with host or port.

Environment variable: QUARKUS_AMQP_DEVSERVICES_ENABLED

Show more

boolean

Optional fixed port the dev service will listen to.

If not defined, the port will be chosen randomly.

Environment variable: QUARKUS_AMQP_DEVSERVICES_PORT

Show more

int

The image to use. Note that only ActiveMQ Artemis images are supported. Specifically, the image repository must end with artemiscloud/activemq-artemis-broker.

Check the activemq-artemis-broker on Quay page to find the available versions.

Environment variable: QUARKUS_AMQP_DEVSERVICES_IMAGE_NAME

Show more

string

quay.io/artemiscloud/activemq-artemis-broker:1.0.25

The value of the AMQ_EXTRA_ARGS environment variable to pass to the container. For ActiveMQ Artemis Broker ⇐ 1.0.21, set this property to --no-autotune --mapped --no-fsync --relax-jolokia --http-host 0.0.0.0

Environment variable: QUARKUS_AMQP_DEVSERVICES_EXTRA_ARGS

Show more

string

--no-autotune --mapped --no-fsync --relax-jolokia

Indicates if the AMQP broker managed by Quarkus Dev Services is shared. When shared, Quarkus looks for running containers using label-based service discovery. If a matching container is found, it is used, and so a second one is not started. Otherwise, Dev Services for AMQP starts a new container.

The discovery uses the quarkus-dev-service-amqp label. The value is configured using the service-name property.

Container sharing is only used in dev mode.

Environment variable: QUARKUS_AMQP_DEVSERVICES_SHARED

Show more

boolean

true

The value of the quarkus-dev-service-aqmp label attached to the started container. This property is used when shared is set to true. In this case, before starting a container, Dev Services for AMQP looks for a container with the quarkus-dev-service-amqp label set to the configured value. If found, it will use this container instead of starting a new one. Otherwise, it starts a new container with the quarkus-dev-service-amqp label set to the specified value.

This property is used when you need multiple shared AMQP brokers.

Environment variable: QUARKUS_AMQP_DEVSERVICES_SERVICE_NAME

Show more

string

amqp

Environment variables that are passed to the container.

Environment variable: QUARKUS_AMQP_DEVSERVICES_CONTAINER_ENV__ENVIRONMENT_VARIABLE_NAME_

Show more

Map<String,String>

Related content