Some mnesia subscription problems.

Hakan Mattsson <>
Fri Sep 6 10:36:05 CEST 2002


On Thu, 5 Sep 2002, martin j. logan wrote:

Martin> Hakan,
Martin>    First off thanks for the reply. I think that I may be running the 
Martin> code while mnesia is still shutting down. Here is my problem.
Martin> I have an event handler that I use to gather mnesia events. I add the 
Martin> handler and I use mnesia:subscribe/1 in its init method.
Martin> At some point I bring mnesia down in order to delete and old schema.
Martin> I get the mnesia_down event. What I would like to do is resubscribe to 
Martin> the new mnesia instance so that I can continue to handle events.
Martin> I can not seem to get it to work though. What mechanism would you 
Martin> suggest using to make my event handler persistant through stops
Martin> and starts?

Have you considered using the event_module configuration parameter?

If you use that, Mnesia will restart your event handler for you at the
startup of Mnesia. A drawback is however that the event handler process
will be stopped when Mnesia is stopped. This means that if you need to
keep the state of the event handler when Mnesia stops, you need to
store it elsewhere, e.g. in an ets table owned by another process.

I think that it is harder to achieve a dependable solution based on
mnesia:subscribe/1.

/Håkan




More information about the erlang-questions mailing list