Dev Services for AMQP

Dev Services AMQP 在开发模式和运行测试时将自动启动 AMQP 1.0 代理,因此您不必手动启动代理。应用程序将自动配置。

Dev Services for AMQP automatically starts an AMQP 1.0 broker in dev mode and when running tests. So, you don’t have to start a broker manually. The application is configured automatically.

Enabling / Disabling Dev Services for AMQP

除非以下情况,否则 Dev Services AMQP 将自动启用:

Dev Services for AMQP is automatically enabled unless:

  • quarkus.amqp.devservices.enabled is set to false

  • the amqp-host or amqp-port is configured

  • all the Reactive Messaging AMQP channels have the host or port attributes set

Dev Services AMQP 依赖 Docker 来启动代理。如果您的环境不支持 Docker,您将需要手动启动代理,或连接到已在运行的代理。您可以使用`amqp-host`、amqp-port、`amqp-user`和`amqp-password`属性配置代理访问。

Dev Services for AMQP relies on Docker to start the broker. If your environment does not support Docker, you will need to start the broker manually, or connect to an already running broker. You can configure the broker access using the amqp-host, amqp-port, amqp-user and amqp-password properties.

Shared broker

大多数时候,您需要在应用程序之间共享代理。Dev Services AMQP 为在_dev_模式下运行的多个 Quarkus 应用程序实现了_service discovery_机制,以便共享一个代理。

Most of the time you need to share the broker between applications. Dev Services for AMQP implements a service discovery mechanism for your multiple Quarkus applications running in dev mode to share a single broker.

Dev Services AMQP 使用`quarkus-dev-service-amqp`标签启动容器,该标签用于标识容器。

Dev Services for AMQP starts the container with the quarkus-dev-service-amqp label which is used to identify the container.

如果您需要多个(共享)代理,您可以配置`quarkus.amqp.devservices.service-name`属性并指示代理名称。它将查找具有相同值或在找不到值时启动一个新值的容器。默认服务名称为`amqp`。

If you need multiple (shared) brokers, you can configure the quarkus.amqp.devservices.service-name attribute and indicate the broker name. It looks for a container with the same value, or starts a new one if none can be found. The default service name is amqp.

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

Sharing is enabled by default in dev mode, but disabled in test mode. You can disable the sharing with quarkus.amqp.devservices.shared=false.

Setting the port

默认情况下,Dev Services AMQP 选择一个随机端口并配置应用程序。您可以通过配置`quarkus.amqp.devservices.port`属性设置端口。

By default, Dev Services for AMQP picks a random port and configures the application. You can set the port by configuring the quarkus.amqp.devservices.port property.

Configuring the image

Dev Services AMQP 使用 activemq-artemis-broker映像。您可以使用`quarkus.amqp.devservices.image-name`属性配置映像和版本:

Dev Services for AMQP uses activemq-artemis-broker images. You can configure the image and version using the quarkus.amqp.devservices.image-name property:

quarkus.amqp.devservices.image-name=quay.io/artemiscloud/activemq-artemis-broker:latest

配置的映像必须是与`activemq-artemis-broker`映像 compatible 。容器使用`AMQ_USER`、`AMQ_PASSWORD`和`AMQ_EXTRA_ARGS`环境变量启动。端口 5672 和 8161(网络控制台)已公开。

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.