[erlang-questions] mnesia:subscribe doco and examples?

jm jeffm@REDACTED
Mon Feb 12 00:36:49 CET 2007


Hakan Mattsson wrote:
> Here is a small example?
> 
> # erl
> Erlang (BEAM) emulator version 5.5.3 [source] [async-threads:0] [kernel-poll:false]
> 
> Eshell V5.5.3  (abort with ^G)
> 1> mnesia:start().
> ok
> 2> mnesia:create_table(t,[]).
> {atomic,ok}
> 3> mnesia:subscribe({table, t}).
> {ok,nonode@REDACTED}
> 4> mnesia:dirty_write(t, {t,12,4 2}).
> ok
> 5> mnesia:dirty_write(t, {t, 12, 43}).
> ok
> 6> mnesia:dirty_delete(t, 12).
> ok
> 7> flush().
> Shell got {mnesia_table_event,{write,{t,12,42},{dirty,<0.30.0>}}}
> Shell got {mnesia_table_event,{write,{t,12,43},{dirty,<0.30.0>}}}
> Shell got {mnesia_table_event,{delete,{t,12},{dirty,<0.30.0>}}}
> ok
> 8> 
> 

Alright. So if this process was implemented using the gen_server 
behavior, the process should see these messages via handle_info()? Yeap, 
just tested that. this appears to be were I'm going wrong. I have a 
mistake in the function patterns. Thanks.


Jeff.




More information about the erlang-questions mailing list