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

标签 rest activemq-artemis

我正在尝试将 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/

相关文章:

http - 为 future 的资源选择正确的 HTTP 返回代码

java - @RolesAllowed 无法通过 Jersey 解决

activemq-artemis - 如何监控ActiveMQ Artemis

java - 使用 Wildlfy 11 嵌入的 Apache Artemis 接收 MQTT 消息

activemq-artemis - Artemis : AMQ222210: Storage usage is beyond max-disk-usage. 系统将开始阻止生产者

testing - JMeter 无法使用 JMS 订阅者读取消息,给我 404 状态代码作为响应

rest - ColdFusion 10 - REST Web 服务错误 - 对象不是声明类的实例

python - 如何在 urllib2.URLError 上打印响应正文?

javascript - 使用浏览器将通过 http 发送的 Base64 编码数据保存为二进制文件

docker - 来自 natted 网络上客户端的 Wildfly : AMQ214016: Failed to create netty connect ion java. nio.channels.UnresolvedAddressException