incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Norman Barker" <norman.bar...@gmail.com>
Subject Re: erlang notifiers and couchdb
Date Wed, 07 Jan 2009 20:56:18 GMT
Jeremy,

thanks, that worked, I followed couch_log as an example but changed
the event manager I was subscribed to couch_db_update and added the
child spec as you suggested.

I followed the blog at
http://spawnlink.com/articles/an-introduction-to-gen_event-account-notifications/
which helped me understand the code.

Many thanks,

Norman

On Tue, Jan 6, 2009 at 6:07 PM, Jeremy Wall <jwall@google.com> wrote:
> Using the OTP principles you would modify the couch_server_sup.erl file and
> add a child spec for your module similar to the child spec for the couch_log
> module in there.
>
> I would recommend reading the OTP documentation on Supervisor trees and
> gen_event behaviours before doing so though. That way you will know what
> exactly it is that you are doing by adding them. Also it would be good to
> add you module to the module list in a custome app file. I'm not sure if
> there is someother hook for this in the code other than _external.
>
> On Tue, Jan 6, 2009 at 5:27 PM, Norman Barker <norman.barker@gmail.com>wrote:
>
>> Hi,
>>
>> I have create an erlang module called couch_db_update_my_notifier
>> which is very similar to couch_db_update_notifier and just prints out
>> events as they are received to stdout.
>>
>> I try to register this module as an event handler as follows within the
>> module
>>
>> start_link(Exec) ->
>>   io:format("***StartLink***"),
>>   couch_event_sup:start_link(couch_db_update,
>> {couch_db_update_my_notifier, make_ref()},  Exec).
>>
>> which is how it is recommended in couch_event_sup.erl
>>
>> Problem is how do I actually load couch_db_update_my_notifier and get
>> start_link invoked, it isn't a daemon, just another listener, and the
>> updatenotification handler in the ini file is for system processes.
>>
>> Is there a way to do this (easily)?  I am a newb at erlang and am
>> writing these modules to find my way around the code.  Having multiple
>> listeners to events is something I will want to have eventually hence
>> why I am trying this.  My aim is to do this in Erlang, I know it can
>> be done with _external.
>>
>> thanks,
>>
>> Norman
>>
>

Mime
View raw message