gpt4 book ai didi

rest - ActiveMQ Artemis REST 接口(interface)配置

转载 作者:行者123 更新时间:2023-12-05 05:51:22 24 4
gpt4 key购买 nike

我正在尝试将 ActiveMQ Artemis 的 REST 接口(interface)添加到我的 Docker 容器中,为此我一直在关注 official guide .我生成了一个 artemis-rest.war 文件并将其移动到我的 /opt/artemis/web 文件夹中。现在,当我导航到 http://localhost:8161/artemis-rest/queues/queue_name 时,我得到了 404。当我尝试导航到 /opt/中列出的其他资源时artemis/web 像/console/或/artemis-plugin/我至少得到某种回应。

我的文件夹结构是这样的:

|-- pom.xml
`-- src
`-- main
`-- webapp
`-- WEB-INF
`-- web.xml
`-- resources
`-- rest.xml

pom.xml:

<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>
<groupId>org.somebody</groupId>
<artifactId>artemis-rest</artifactId>
<packaging>war</packaging>
<name>ActiveMQ Artemis REST</name>
<version>2.17.0</version>

<dependencies>
<dependency>
<groupId>org.apache.activemq.rest</groupId>
<artifactId>artemis-rest</artifactId>
<version>2.17.0</version>
<exclusions>
<exclusion>
<groupId>org.apache.activemq</groupId>
<artifactId>*</artifactId>
</exclusion>
<exclusion>
<groupId>io.netty</groupId>
<artifactId>*</artifactId>
</exclusion>
<exclusion>
<groupId>org.eclipse.jetty.aggregate</groupId>
<artifactId>*</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>*</artifactId>
</exclusion>
<exclusion>
<groupId>org.jboss.logging</groupId>
<artifactId>*</artifactId>
</exclusion>
<exclusion>
<groupId>org.jboss.logmanager</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</project>

rest.xml:

<rest-messaging>
<server-in-vm-id>0</server-in-vm-id> <!-- deprecated, use "url" -->
<use-link-headers>false</use-link-headers>
<default-durable-send>false</default-durable-send>
<dups-ok>true</dups-ok>
<topic-push-store-dir>topic-push-store</topic-push-store-dir>
<queue-push-store-dir>queue-push-store</queue-push-store-dir>
<producer-time-to-live>0</producer-time-to-live>
<producer-session-pool-size>10</producer-session-pool-size>
<session-timeout-task-interval>1</session-timeout-task-interval>
<consumer-session-timeout-seconds>300</consumer-session-timeout-seconds>
<consumer-window-size>-1</consumer-window-size> <!-- deprecated, use "url" -->
<url>vm://0</url>
</rest-messaging>

web.xml:

<web-app>
<listener>
<listener-class>org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap</listener-class>
</listener>

<listener>
<listener-class>org.apache.activemq.artemis.rest.integration.RestMessagingBootstrapListener</listener-class>
</listener>

<filter>
<filter-name>Rest-Messaging</filter-name>
<filter-class>org.jboss.resteasy.plugins.server.servlet.FilterDispatcher</filter-class>
</filter>

<filter-mapping>
<filter-name>Rest-Messaging</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<context-param>
<param-name>rest.messaging.config.file</param-name>
<param-value>rest.xml</param-value>
</context-param>
</web-app>

我错过了什么吗?我还需要配置什么吗?我本来认为包含 .war 文件就足够了,至少会出现某种错误。

最佳答案

需要在etc/bootstrap.xml中部署artemis-rest.war,例如:

   <web bind="http://localhost:8161" path="web">
...
<app url="artemis-rest" war="artemis-rest.war"/>
</web>

嵌入式 web 服务器不会自动部署 artemis-rest.war 只是因为您将它放入 web 目录。

关于rest - ActiveMQ Artemis REST 接口(interface)配置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70381082/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com