Search the web
Sign In
New User? Sign Up
rest-discuss · REST Discussion Mailing List
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Want to share photos of your group with the world? Add a group photo to Flickr.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Message queues   Message List  
Reply | Forward Message #8955 of 14088 |
Reading the docs at http://activemq.apache.org/ I noticed they have a
REST API. So I clicked on http://activemq.apache.org/rest.html to
read more and, perhaps not surprisingly, found that it's pretty broken
REST.

Adding a message to the queue seems fine... they give as an example
a queue at http://www.acme.com/queue/orders/input and you can add a
new message in the queue by POSTing to that URL. Fine.

Consuming a message from the queue, though, seems problematic.
They allow either GET or DELETE on the *same* URL to pop a message
from the queue.

They are aware that this is wrong:
"Note that strict REST requires that GET be a read only operation; so
strictly speaking we should not use GET to allow folks to consume
messages. Though we allow this as it simplifies HTTP/DHTML/Ajax
integration somewhat."

... but they don't seem to understand *how* wrong it is:

* it's not REST that says GET is a read-only operation; it's HTTP. So
their HTTP implementation is broken. Sadly seems to be pretty common.

* DELETE on a URL representing a queue means you want to delete the
entire queue, not a single message!

The reason I'm writing to this list is that I thought it was an
interesting case and I couldn't immediately think of better solution.
Has anybody thought of a good way to model a queue?

You could of course do a GET on the queue, returning a list of
available messages, then DELETE one of those - but that leads to
concurrency problems.

--

Paul Winkler
http://www.slinkp.com



Tue Jun 12, 2007 8:08 pm

slinkp23
Offline Offline
Send Email Send Email

Forward
Message #8955 of 14088 |
Expand Messages Author Sort by Date

Reading the docs at http://activemq.apache.org/ I noticed they have a REST API. So I clicked on http://activemq.apache.org/rest.html to read more and, perhaps...
Paul Winkler
slinkp23
Offline Send Email
Jun 12, 2007
8:15 pm

... To retrieve a message from the queue you should do this: POST /queue/ => 201, Location /queue/snapshotIDxxxx GET /queue/snapshotIDxxxx => 200, state of the...
Nic James Ferrier
nferrier_tap...
Offline Send Email
Jun 12, 2007
8:34 pm

... (snip) ... I think that's typically the case. ... I don't know... if the client dies after creating the snapshot, you've effectively thrown away a bunch of...
Paul Winkler
slinkp23
Offline Send Email
Jun 12, 2007
8:54 pm

... Then you have to arbitrate who is subscribed and who has, or rather has not, created a snapshot and not remove the item from the queue until everyone has...
Nic James Ferrier
nferrier_tap...
Offline Send Email
Jun 12, 2007
9:13 pm

How about somebody go and implement an example of a RESTful approach to a queue using only HTTP and document it. If you like Java, you can use this age old...
Mike Dierken
mdierken
Offline Send Email
Jun 12, 2007
9:32 pm

... http://www.dehora.net/doc/httplr/draft-httplr-01.html#rfc.section.9 I'm sure I would change some things on reflection. cheers Bill...
Bill de hOra
bdehora
Offline Send Email
Jun 12, 2007
10:37 pm

... That looks pretty well thought out... but it also takes three requests to do a single pop. That strikes me as a lot of overhead. I wonder if this case is...
Paul Winkler
slinkp23
Offline Send Email
Jun 13, 2007
12:41 am

Why would RPC take fewer round trips?...
Mike Dierken
mdierken
Offline Send Email
Jun 13, 2007
4:52 am

... I meant something like: service = SomeFlavorOfRPCServer('http://example.org/endpoint') message = service.popMessage() But now I realize this lacks the...
Paul Winkler
slinkp23
Offline Send Email
Jun 13, 2007
2:26 pm

... How about using different media types? To add an item: POST /queue Content-Type: application/xml (or whatever a queue item is) --> 201 Created Location:...
Steve Bjorg
steve_bjorg
Offline Send Email
Jun 13, 2007
2:42 pm

FWIW, the typical MSMQ pattern is that the 'pop' is destructive. when a client 'reads' a message, it is permanently removed from the stack. it is assumed that,...
mike amundsen
mamund
Offline Send Email
Jun 13, 2007
2:54 pm

... What about a having a URI representing the end of the queue, e.g. http://example.com/queue/last A DELETE on that URI redirects with a 303 to the current...
Ian Davis
ianalchemy
Offline Send Email
Jun 14, 2007
12:00 am

I like that definition of a resourcew, but how would you handle the problem of lost messages? John Heintz ... -- John D. Heintz Principal Consultant New...
John D. Heintz
johndheintz
Offline Send Email
Jun 14, 2007
1:32 am

... What John said and also how do you handle the fact that one client's last is not necessarily another's. At the very least clients need to identify...
Yohanes Santoso
gnome_g
Offline Send Email
Jun 14, 2007
3:29 am

... If you use "personalised" (i.e. different) URLs, then these represent different queue resources. If you really mean to have a personalised queue, use the...
Chris Burdess
dog@...
Send Email
Jun 14, 2007
8:11 am

... Different URLs do not imply different resources. However, in the above case, the different URLs happen to point to different resources which share the same...
Yohanes Santoso
gnome_g
Offline Send Email
Jun 14, 2007
6:36 pm

... 3rd party monitoring was my number one operations use case for HTTPLR. In the case where clients are supposed to "take" messages as opposed to "read" them,...
Bill de hOra
bdehora
Offline Send Email
Jun 14, 2007
7:46 pm

... In retrospect this isn't a great solution since 303 requires the redirect to be followed with a GET rather than a DELETE Ian -- work -...
Ian Davis
ianalchemy
Offline Send Email
Jun 15, 2007
5:57 am

... Well, strictly it's a SHOULD rather than a MUST. Of course SHOULD's mean you do it unless you have a darn good reason not to AND have considered all...
Jon Hanna
hack_poet
Online Now Send Email
Jun 15, 2007
9:05 am

... There isn't a way to say that (with HTTP at least). That's why you need to at least coordinate on a data structure describing the collection. It's one...
Bill de hOra
bdehora
Offline Send Email
Jun 14, 2007
7:41 pm

... Which may not be suitable when there are multiple consumers waiting. The problem here is snapshot preserves the view of the whole queue much like...
Yohanes Santoso
gnome_g
Offline Send Email
Jun 13, 2007
2:50 pm

... I'm still unclear why the queue cannot be implemented using DELETE to pop the queue entry. You GET the current state of the queue, which contains links to...
Chris Burdess
dog@...
Send Email
Jun 13, 2007
4:40 pm

Paul Winkler ... Rather ironic given Roy Fielding's high profile role related to Apache... -- -Mike Schinkel http://www.mikeschinkel.com/blogs/ ...
Mike Schinkel
mikeschinkel
Offline Send Email
Jun 12, 2007
8:35 pm

... The Apache project does a lot of things besides the excellent http server. Judging by their java xmlrpc client library, not all things under the Apache...
Paul Winkler
slinkp23
Offline Send Email
Jun 12, 2007
8:45 pm

... Not really. Apache is a massive umbrella under which much that is rubbish shelters with much that is utterly fantastic. -- Nic Ferrier ...
Nic James Ferrier
nferrier_tap...
Offline Send Email
Jun 12, 2007
9:04 pm

... Nobody in Apache imposes architectural rules on any project; it is up to the separate communities to choose the areas of intest, and the implementation. ...
Steve Loughran
steve_loughran
Offline Send Email
Jun 13, 2007
1:01 pm

... I seem to recall saying something like that to James Strachan ages ago. In fairness to the ActiveMQ crew they rolled that out a few years ago now, and...
Bill de hOra
bdehora
Offline Send Email
Jun 12, 2007
10:39 pm

Joe Gregorio wrote about the amzon queue service in an XML article. http://www.xml.com/pub/a/2005/01/05/restful.html But the pop operation use GET and DELETE...
Benoit Fleury
benoit_f4y
Offline Send Email
Jun 13, 2007
6:53 am

... I don't see anything wrong with that (possibly timing issues when two clients consume the same item). GET to find out the queue entry. DELETE to remove it...
Dave Pawson
dpawson2000
Offline Send Email
Jun 13, 2007
7:22 am
First  | < Prev  |  Last 
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help