<HTML><BODY style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; ">Hello,<DIV><BR class="khtml-block-placeholder"></DIV><DIV>I am trying to understand some Mnesia concepts and am wondering about the capabilities of notifying of changes.</DIV><DIV>Indeed, in a traditional application using a database such as MySQL for example, if I want to make sure I always have the last version of some data, I need to either:</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>A) never cache any data in memory and refetch data at each query</DIV><DIV>B) use a memory cache (we use Cayenne with Java) and make sure all reads and writes are always going through the same process / cache</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>In some situations this is not acceptable.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Therefore, in the situation were I implement some services using a database, I want to make sure that when the database changes, all processes (Erlang or others) get notified of a change.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>To achieve this I thought it would be possible to implement the business logic in Erlang using Mnesia as a back-end database. Then, have one Erlang process listening to all changes to the tables and for each change, send a message, for example on a message bus such as RabbitMQ. Then, clients in other languages than Erlang could listen to changes and update an object graph accordingly.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Is this the way to go? In details:</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>1) is using table events in Mnesia a usual way to notify other processes of changes?</DIV><DIV>2) I suppose the events are sent aynchronously... what about performance issues?</DIV><DIV>3) If I have a multi-node Mnesia database, I suppose I will only receive one event per event (not one per node)?</DIV><DIV>4) If this is the way to go, would you send on the bus:</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre"> </SPAN>a) the Name and Key of the record(s) which changed (leaving the listening, non Erlang process to refetch immediately after what it needs)</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre"> </SPAN>b) the complete record(s), event the attributes which didn't change</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre"> </SPAN>c) only the changed attributes</DIV><DIV>I was thinking of converting the events in JSON messages which could be listened to from any non Erlang process. Actually, this seems rather generic so maybe someone already had a thought about that kind of architecture.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV> In practice, we are considering rewriting a module of our system. By putting in place some standardized way of communicating between Applications we can develop the new system incrementally.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Thanks for any hints!</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Alex</DIV><DIV><DIV> <SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><DIV>--</DIV><DIV>Alexander Lamb</DIV><DIV>Founding Associate</DIV><DIV>RODANOTECH Sàrl</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>4 ch. de la Tour de Champel</DIV><DIV>1206 Geneva</DIV><DIV>Switzerland</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Tel: 022 347 77 37</DIV><DIV>Fax: 022 347 77 38</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><A href="http://www.rodanotech.ch">http://www.rodanotech.ch</A></DIV><DIV><BR class="khtml-block-placeholder"></DIV></SPAN></SPAN><BR class="Apple-interchange-newline"></SPAN> </DIV><BR></DIV></BODY></HTML>