How to implement a messaging system?

Amir Ansari fractallyte at csi.com
Mon Jan 3 10:32:05 UTC 2011


Hi Chris

I originally thought to create a mailbox for each user in a MagmaPreallocatedDictionary, with the association User -> OrderedCollection (where 'User' is an instance of class 'User', so each item would be unique).

So, checking up on one's own mailbox would simply entail finding oneself's User in the Dictionary and reading the associated collection of messages.

However, if another user were to drop a message into this collection, the same OrderedCollection would have to be accessed by another session.  Isn't this a no-no, even with refreshing a session?

Are you suggesting to use MagmaCollections instead of OrderedCollections?  Isn't that far more 'expensive', especially since each user on the system would be assigned such a collection just to hold their messages?

Amir


On Sun, 2 Jan 2011 19:30:19 -0600
Chris Muller <asqueaker at gmail.com> wrote:

> Because for user A and user B, each accessing the one persistent model
> via Session A and Session B, respectively, A would add Message-A to
> B's 'collection' which he accessed from his session.  After B
> refreshed his session, his view of the model would reflect his own
> copy of Message-A in his own copy of B's 'collection'.
> 
> > What is the proper way to implement such a system?  I'd be very grateful for any insight!
> 
> What you said should work just fine.  Use MagmaCollections with an
> index on the timestamp so you don't have to worry about
> commit-conflicts.


More information about the Magma mailing list