A RESTful queue

As messaging and therefore queues is close to my heart, I’ve been following the discussions on rest-discuss on how to construct a RESTful queue with great interest. The discussion started (as did my thinking on the topic a year or so back) around how ActiveMQ has choosen to implement their REST support, a somewhat broken model as pointed out by Paul Winkler (e.g. non-safe GET, DELETE on queue deletes message rather than the queue).

My favorite model so far is the one suggested by Steve Bjorg, also quite similar to the one described in HTTPLR. In that case you would push messages onto a queue with POST and pop then with a combination of POST and DELETE. To quote from Steve’s email.

To add an item:
POST /queue
Content-Type: application/xml (or whatever a queue item is)
–>
201 Created
Location: http://server.com/queue/itemXYZ

To request to pop an item:
POST /queue
Content-Type: application/w-www-form-urlencoded
AckTTL=60 (where AckTTL is the time to acknowledge the queue item or
it becomes available again)
–>
200 Ok
http://server.com/queue/itemABC

To delete a popped item:
DELETE /queue/itemABC

Go read the discussion thread as it contains many interesting aspects on this pretty hard problem. Ideas on how to improve the current suggestions is very welcome.

2 Responses

  1. James Strachan Says:
    BTW I’ve been meaning to delve into this thread, catch up on what folks suggest and respond.

    But briefly - I’d *LOVE* a nice, proper, RESTful API to ActiveMQ. I’ve wanted to get the cycles to fix this for the longest time - but as the discussion shows its non trivial, but I am liking the looks of what you suggest.

    Ideally I was also thinking we should expose the entire broker as an Atom Publishing Protocol; so an APP client could discover all the queues & topics etc.

  2. James Strachan Says:
    Here’s my first attempt at a truly RESTful API using AtomPub…

    http://macstrac.blogspot.com/2007/08/pure-restful-api-to-activemq-via.html

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.