[erlang-questions] extending mnesia:subscribe/1 functionality

Vans S vans_163@REDACTED
Thu Nov 10 18:04:34 CET 2016

I function I often find myself needing around subscribe is to only subscribe for certain keys. 

For example if we have 10,000 processes subscribing via:
mnesia:subscribe({table, Table, detailed})

We will get 10,000 of the same message, every time.

What if we could subscribe like:

mnesia:subscribe({table, Table, {detailed, uuid_1234}})

mnesia:subscribe({table, Table, {detailed, {'_', uuid_1234}}})

What this means.

This means the subscribing process to that table will only receive subscription messages if the key of the mnesia record matches what was given.

In the second example, if the key is composite, we can filter on it too.

What do you think?

More information about the erlang-questions mailing list