|
Hello, Is there a best practice for handling transient sessions - where server and local queues are created, publish and consume one message, then destroyed? I'm thinking of a case where I service web pages. If I keep the same queues alive between transactions, then it is concievable that one persons web page could display data from the previous transaction - if that transaction is canceled before it receives a response, then the subsequent transaction will receive an invalid response. If I key the transactions, I can reject invalid transactions. Thoughts? I'm looking into the capabilities of my web framework (Django) to handle persistent objects. Thanks, -Josh -- ----- http://www.globalherald.net/jb01 GlobalHerald.NET, the Smarter Social Network! (tm) --------------------------------------------------------------------- Apache Qpid - AMQP Messaging Implementation Project: http://qpid.apache.org Use/Interact: mailto:[hidden email] |
|
Hi, Josh.
Do you have some kind of user session id you could use to create session-scoped queues? With a queue per active user, the world would remain coherent without the need to create and destroy things too much. Justin -------- Original Message -------- Subject: Best Practice for Transient Sessions? Date: Wed, 28 Jan 2009 11:05:00 -0500 (EST) From: Joshua Kramer <[hidden email]> Reply-To: [hidden email] To: [hidden email] Hello, Is there a best practice for handling transient sessions - where server and local queues are created, publish and consume one message, then destroyed? I'm thinking of a case where I service web pages. If I keep the same queues alive between transactions, then it is concievable that one persons web page could display data from the previous transaction - if that transaction is canceled before it receives a response, then the subsequent transaction will receive an invalid response. If I key the transactions, I can reject invalid transactions. Thoughts? I'm looking into the capabilities of my web framework (Django) to handle persistent objects. Thanks, -Josh -- ----- http://www.globalherald.net/jb01 GlobalHerald.NET, the Smarter Social Network! (tm) --------------------------------------------------------------------- Apache Qpid - AMQP Messaging Implementation Project: http://qpid.apache.org Use/Interact: mailto:[hidden email] |
|
Justin Ross wrote:
> Hi, Josh. > > Do you have some kind of user session id you could use to create session-scoped queues? With a queue per active user, the world would remain coherent without the need to create and destroy things too much. > Josh - if you create sessions without explcitly giving them a name, qpid will generate a UUID as the name. You can get it with session.getId().getName() Of course if you have your own unique session identifier you can use that instead. > Justin > > -------- Original Message -------- > Subject: Best Practice for Transient Sessions? > Date: Wed, 28 Jan 2009 11:05:00 -0500 (EST) > From: Joshua Kramer <[hidden email]> > Reply-To: [hidden email] > To: [hidden email] > > Hello, > > Is there a best practice for handling transient sessions - where server > and local queues are created, publish and consume one message, then > destroyed? > > I'm thinking of a case where I service web pages. If I keep the same > queues alive between transactions, then it is concievable that one persons > web page could display data from the previous transaction - if that > transaction is canceled before it receives a response, then the subsequent > transaction will receive an invalid response. If I key the transactions, > I can reject invalid transactions. > > Thoughts? > > I'm looking into the capabilities of my web framework (Django) to handle > persistent objects. > > Thanks, > -Josh > --------------------------------------------------------------------- Apache Qpid - AMQP Messaging Implementation Project: http://qpid.apache.org Use/Interact: mailto:[hidden email] |
|
Alan Conway wrote:
> Justin Ross wrote: >> Hi, Josh. >> Do you have some kind of user session id you could use to create >> session-scoped queues? With a queue per active user, the world would >> remain coherent without the need to create and destroy things too much. > > Josh - if you create sessions without explcitly giving them a name, > qpid will generate a UUID as the name. > You can get it with session.getId().getName() The request-response example does just this. In the C++ flavor: stringstream response_queue; response_queue << "client" << session.getId().getName(); session.queueDeclare(arg::queue=response_queue.str()); session.exchangeBind(arg::exchange="amq.direct", arg::queue=response_queue.str(), arg::bindingKey=response_queue.str()); Remember to delete the queue when you're done with it, or queues will accumulate on the server. But if you want a user's queue to persist on the server, save an identifier in a cookie or some other place. Jonathan --------------------------------------------------------------------- Apache Qpid - AMQP Messaging Implementation Project: http://qpid.apache.org Use/Interact: mailto:[hidden email] |
|
> Remember to delete the queue when you're done with it, or queues will > accumulate on the server. In python - is it enough to call the close() method of the queue object, or is there also some sort of destroy() method? Thanks, -Josh -- ----- http://www.globalherald.net/jb01 GlobalHerald.NET, the Smarter Social Network! (tm) --------------------------------------------------------------------- Apache Qpid - AMQP Messaging Implementation Project: http://qpid.apache.org Use/Interact: mailto:[hidden email] |
|
Joshua Kramer wrote:
> >> Remember to delete the queue when you're done with it, or queues will >> accumulate on the server. > > In python - is it enough to call the close() method of the queue object, > or is there also some sort of destroy() method? Calling the close() method of the queue object does NOT delete the queue on the server. You can use the queue_delete(...) method for that. --Rafael --------------------------------------------------------------------- Apache Qpid - AMQP Messaging Implementation Project: http://qpid.apache.org Use/Interact: mailto:[hidden email] |
|
Rafael Schloming wrote:
> Joshua Kramer wrote: >> >>> Remember to delete the queue when you're done with it, or queues will >>> accumulate on the server. >> >> In python - is it enough to call the close() method of the queue >> object, or is there also some sort of destroy() method? > > Calling the close() method of the queue object does NOT delete the queue > on the server. You can use the queue_delete(...) method for that. > > --Rafael when you close your session --------------------------------------------------------------------- Apache Qpid - AMQP Messaging Implementation Project: http://qpid.apache.org Use/Interact: mailto:[hidden email] |
|
In reply to this post by Joshua Kramer
Joshua Kramer wrote:
> >> Remember to delete the queue when you're done with it, or queues will >> accumulate on the server. > > In python - is it enough to call the close() method of the queue > object, or is there also some sort of destroy() method? qpid.session.Session.queueDelete() is your friend. I will be posting API docs for Python on the Qpid site today or tomorrow, but here's the method you are looking for. Jonathan delete a queue This command deletes a queue. When a queue is deleted any pending messages are sent to the alternate-exchange if defined, or discarded if it is not. queue Specifies the name of the queue to delete. if_unused -- delete only if unused If set, the server will only delete the queue if it has no consumers. If the queue has consumers the server does does not delete it but raises an exception instead. if_empty -- delete only if empty If set, the server will only delete the queue if it has no messages. --------------------------------------------------------------------- Apache Qpid - AMQP Messaging Implementation Project: http://qpid.apache.org Use/Interact: mailto:[hidden email] |
|
In reply to this post by Alan Conway
Alan Conway wrote:
> you can also declare the queue with auto_delete=true if you want it > automatically deleted > when you close your session And that's more robust - it does not depend on your program to get it right, and it works even if your program crashes. Jonathan --------------------------------------------------------------------- Apache Qpid - AMQP Messaging Implementation Project: http://qpid.apache.org Use/Interact: mailto:[hidden email] |
|
In reply to this post by Joshua Kramer
I just posted Python API docs here:
http://people.apache.org/~jonathan/qpid/api/python/html/ I'll be linking to that form the wiki. I've decided I'm a fan of epydoc ;-> Jonathan --------------------------------------------------------------------- Apache Qpid - AMQP Messaging Implementation Project: http://qpid.apache.org Use/Interact: mailto:[hidden email] |
|
Jonathan Robie wrote:
> I just posted Python API docs here: > > http://people.apache.org/~jonathan/qpid/api/python/html/ > > I'll be linking to that form the wiki. I've decided I'm a fan of > epydoc ;-> > > Jonathan > > --------------------------------------------------------------------- > Apache Qpid - AMQP Messaging Implementation > Project: http://qpid.apache.org > Use/Interact: mailto:[hidden email] > don't post it in your home, dir let put it under docs section. I can help you Carl. --------------------------------------------------------------------- Apache Qpid - AMQP Messaging Implementation Project: http://qpid.apache.org Use/Interact: mailto:[hidden email] |
|
Carl Trieloff wrote:
> don't post it in your home, dir let put it under docs section. I can > help you OK - thanks, see you in IRC! Jonathan --------------------------------------------------------------------- Apache Qpid - AMQP Messaging Implementation Project: http://qpid.apache.org Use/Interact: mailto:[hidden email] |
|
In reply to this post by Jonathan Robie
Jonathan Robie wrote:
> I just posted Python API docs here: > > http://people.apache.org/~jonathan/qpid/api/python/html/ > > I'll be linking to that form the wiki. I've decided I'm a fan of > epydoc ;-> > > Jonathan > > --------------------------------------------------------------------- > Apache Qpid - AMQP Messaging Implementation > Project: http://qpid.apache.org > Use/Interact: mailto:[hidden email] > Can you remove references to the management and managementdata modules? These are obsolete. Thanks, -Ted --------------------------------------------------------------------- Apache Qpid - AMQP Messaging Implementation Project: http://qpid.apache.org Use/Interact: mailto:[hidden email] |
|
Ted Ross wrote:
> Can you remove references to the management and managementdata > modules? These are obsolete. Eventually, but .... There are actually a zillion obsolete things in the generated API docs, which makes them a bit of a trap. It needs major cleaning, either by cleaning up the API itself (the better way?) or by maintaining a list over time of which parts of the API are there only for historical purposes. Not sure how to proceed on this. But doing this for just two modules probably isn't best. Jonathan --------------------------------------------------------------------- Apache Qpid - AMQP Messaging Implementation Project: http://qpid.apache.org Use/Interact: mailto:[hidden email] |
|
In reply to this post by Alan Conway
On Wed, 28 Jan 2009, Alan Conway wrote: > you can also declare the queue with auto_delete=true if you want it > automatically deleted > when you close your session What about the local queues generated by session.incoming(), such as: locLocalQueue = session.incoming(locLocalQueueName, auto_delete=True) Obviously auto_delete doesn't work here - but are these queues discarded when the session is closed? Thanks! -Josh -- ----- http://www.globalherald.net/jb01 GlobalHerald.NET, the Smarter Social Network! (tm) --------------------------------------------------------------------- Apache Qpid - AMQP Messaging Implementation Project: http://qpid.apache.org Use/Interact: mailto:[hidden email] |
|
> Obviously auto_delete doesn't work here - but are these queues > discarded when the session is closed? > yes, when the session closes --------------------------------------------------------------------- Apache Qpid - AMQP Messaging Implementation Project: http://qpid.apache.org Use/Interact: mailto:[hidden email] |
| Powered by Nabble | Edit this page |
