Home > Net >  ActiveMQ Artemis REST Interface configuration
ActiveMQ Artemis REST Interface configuration

Time:12-18

I'm attempting to add ActiveMQ Artemis' REST interface to my Docker container, and for that I have been following the official guide. I generate a artemis-rest.war file and move it into my /opt/artemis/web folder. Now when I navigate to http://localhost:8161/artemis-rest/queues/queue_name, I get a 404. When I try to navigate to other resources listed in the /opt/artemis/web like /console/ or /artemis-plugin/ I get at least some sort of a response.

My folder structure looks like this:

|-- 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>

Have I missed something? Do I need to still need to configure something? I would have though that that including the .war file would be enough, to at least get an error of some kind.

CodePudding user response:

You need to deploy artemis-rest.war in etc/bootstrap.xml, e.g.:

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

The embedded web server won't automatically deploy artemis-rest.war just because you put it into the web directory.

  • Related