Help with Webmachine/Couchbeam combo

James Aimonetti <>
Fri Apr 23 15:47:13 CEST 2010


I have a Webmachine app that is using Couchdb, and I'm using Couchbeam 
to retrieve and store documents and views.

I start couchbeam up in a module that up to this point I called in my 
wm_app.erl (assuming I created the webmachine project with the name 
wm_app). The module called looks like this:

% wm_app_couch.erl
start() ->
  couchbeam:start(),
  Conn = couchbeam_server:start_connection_link(#couchdb_params{}),
  couchbeam_db:open_or_create(Conn, {?DB, atom_to_list(?DB)}).

As I've tested storing and retrieving docs and views in the shell, on 
occasion the Db process or Conn process will die and I have to manually 
restart the processes.

How do I add couchbeam, the Conn, and the Db pids to the wm_app_sup.erl 
supervisor to make sure they're automatically restarted should they die? 
I guess I'm not sure how to structure the ChildSpec for each, especially 
when the Db pid is generated using the Conn pid as an argument. Or is 
there a better, more appropriate solution.

Sorry if this is n00b territory.

-- 
James Aimonetti
mobile: 314.809.6307
work: 540.459.2220
email: 
website: http://jamesaimonetti.com



More information about the erlang-questions mailing list