Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Here's what I would propose as the general workflow:</p> <ol> <li>When user clicks Generate: serialize the data they've entered and any other relevant metadata (e.g. priority, username) and POST it to couchdb as a new document. Keep track of the _id of the document.</li> <li>Code up a background process that monitors couchdb for documents that need processing.</li> <li>When it sees such a document, have it generate the PDF and attach it to that same couch doc.</li> <li>Now back to the client side. You could use ajax polling to repeatedly GET the couch doc and test whether is has an attachment or not. If it does, then you can show the user the download link.</li> </ol> <p>Of course the devil is in the details...</p> <p>Two ways your background process(es) can identify pending documents:</p> <ul> <li>Use the <a href="http://books.couchdb.org/relax/reference/change-notifications/" rel="nofollow noreferrer">_changes API</a> to monitor for new documents with _rev beginning with "1-"</li> <li>Make requests on a couchdb view that only returns docs that do not have an "_attachments" property. When there are no documents to process it will return nothing. <ul> <li>Optionally: If you have multiple PDF-making processes working on the queue in parallel you will want to update the couch doc with a property like <code>{"being-processed":true}</code> and filter these out the view as well.</li> </ul></li> </ul> <p>Some other thoughts:</p> <ul> <li>I do not recommend using the couchdb externals API for this use case because it (basically) means couchdb and your PDF-generating code must be on the same machine. But it's something to be aware of.</li> <li>I don't know a thing about GWT, but it doesn't seem necessary to accomplish your goals. Certainly CouchDB can serve any static files (js or other) you want either as attachments to docs in a db or from the filesystem. You could even eval() JSON properties you put into couch docs. So you can use GWT to make ajax calls or whatever but GWT can be completely decoupled from couchdb. Might be simpler that way.</li> </ul>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload