How to implement a messaging system?

Facundo Vozzi facundov79 at gmail.com
Mon Jan 3 13:30:42 UTC 2011


Hi Amir,
I think that you can try modeling the MailingSystem class wich could be a
singleton with users and each user would have his own messages.
Users and messages would be MagmaCollections and then you would've three
main classes MailingSystem, User and Message for the beggining.
Last, you would make persistent your singleton.

My two cents,
Facu



On Mon, Jan 3, 2011 at 7:32 AM, Amir Ansari <fractallyte at csi.com> wrote:

> 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.
> _______________________________________________
> Magma mailing list
> Magma at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/magma
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/magma/attachments/20110103/08ba5bab/attachment.htm


More information about the Magma mailing list