NAME AtomMQ - An atompub server that supports the message queue/bus model. VERSION version 0.0100 SYNOPSIS #!/usr/bin/perl use AtomMQ; my $dsn = 'dbi:SQLite:dbname=foo.db'; my $server = AtomMQ->new(feed => 'MyCoolFeed', dsn => $dsn); $server->run; DESCRIPTION An atompub server that supports the message queue/bus model. Throughout this document, I will use the term message when refering to an atom feed entry, since the point of this module is to use atompub for messaging purposes. AtomMQ extends Inoue's Atompub::Server which extends Miyagawa's XML::Atom::Server. Can you feel the love already? Usage: #!/usr/bin/perl use AtomMQ; my $dsn = 'dbi:SQLite:dbname=foo.db'; my $server = AtomMQ->new(feed => 'MyCoolFeed', dsn => $dsn); $server->run; Just drop the above file in your cgi-bin folder on your web server, and you will have a shiny new atompub server with a feed titled MyCoolFeed. It can also be run via mod_perl on apache, but that is more complicated. To create more feeds, just copy that file and change 'MyCoolFeed' to 'MyOtherFeed'. To publish a message to AtomMQ, make a HTTP POST request: $ curl -d ' allo
an important message
' http://localhost/cgi-bin/mycoolfeed Where mycoolfeed is the name of the file you created in cgi-bin. So how is this different than a regular atompub server? Just one simple thing. A concept of lastid. So if you just do: $ curl http://localhost/cgi-bin/mycoolfeed you will get all messages since the feed was created. But lets say you are running a client that polls the feed and processes messages. If this client dies, you will not want it to process all the messages again. So clients are responsible for maintaining and persisting the id of the last message they processed. This allows a client to request only messages that came after the message with the given id. They can do this by passing a Xlastid header: $ curl -H 'Xlastid: 42' http://localhost/cgi-bin/mycoolfeed That will return only messages that came after the message that had id 42. AUTHOR Naveed Massjouni COPYRIGHT AND LICENSE This software is copyright (c) 2010 by Naveed Massjouni. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.