You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by "Mark Frazier (JIRA)" <ji...@apache.org> on 2015/01/21 03:33:34 UTC

[jira] [Commented] (AMQ-5478) REST endpoint creates topic instead of queue

    [ https://issues.apache.org/jira/browse/AMQ-5478?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14285045#comment-14285045 ] 

Mark Frazier commented on AMQ-5478:
-----------------------------------

According to the code, if NO type parameter is specified, the default will be topic, UNLESS the servlet has been initialized with an init param in the web.xml file. See code snippet below:

    protected boolean isTopic(HttpServletRequest request) {
        String typeText = request.getParameter(typeParameter);
        if (typeText == null) {
            return defaultTopicFlag;
        }
        return typeText.equalsIgnoreCase("topic");
    }

To change this default, you can do this in the webapps/demo/WEB-INF/web.xml file:

<servlet>
    <servlet-name>MessageServlet</servlet-name>       
    <servlet-class>org.apache.activemq.web.MessageServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
    <init-param>
            <param-name>topic</param-name>
            <param-value>false</param-value>
    </init-param>
</servlet>

However, you are correct. The documentation is a bit misleading and should point this out. I will see if I can do that.

> REST endpoint creates topic instead of queue
> --------------------------------------------
>
>                 Key: AMQ-5478
>                 URL: https://issues.apache.org/jira/browse/AMQ-5478
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: webconsole
>    Affects Versions: 5.10.0
>            Reporter: Paul Smith
>            Priority: Minor
>
> This is _possibly_ simply a Documentation bug, but I was testing the REST endpoints via the documentation here:
> http://activemq.apache.org/rest.html
> When I first tried to post a simple message to a queue (and this queue didn't exist yet) I used this script:
> {noformat}
> $ curl -d "body=message" -XPOST http://admin:admin@localhost:8161/api/message/queue/orders/input
> {noformat}
> The above is mostly based on the documentation.  I was surprised to find no queue created by looking at the web console, but i _*did*_ see a Topic created called 'queue.orders.input' and it contained 1 message (odd because there's no consumers defined).
> After deleting the topic I then tried the 'other format' of the URL:
> {noformat}
>  curl -d "body=message" -XPOST http://admin:admin@localhost:8161/api/message/orders.input?type=queue
> {noformat}
> This does create a Queue of name 'orders.input' as one would expect.
> I'm not exactly clear then from the documentation where in the URL one is defining it as a queue using the former syntax.  The URL in the documentation sort of _implies_ that the 'queue' prefix of the URL is creating a queue named 'orders.input' but it doesn't turn out that way.
> So either this is a bug, or the documentation needs tweaking.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)