Re: server-to-client event push - Re: relationship query and cache refreshing in 3tier cayenne

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Thu May 15 2008 - 10:05:50 EDT

  • Next message: Kevin Menard: "I'm back"

    On May 15, 2008, at 5:26 AM, Aristedes Maniatis wrote:

    >
    > On 15/05/2008, at 7:43 AM, Andrus Adamchik wrote:
    >
    >> 1. Client sends a "give me events" request in the beginning of the
    >> session (separate from data requests), and reads everything that
    >> comes back.
    >
    >
    > Three thoughts:
    >
    > 1. Is your idea to have one queue per client, or a single queue with
    > some sort of sequence numbering so a client can grab events later
    > than a particular timestamp/sequence?

    As the events will be dispatched immediately (there will be no client
    polling), the only queue involved is the local EventManager queue.
    There is a single one per DataDomain and it is shared by all server
    contexts.

    > 2. Even without continuations the basic idea could still work if the
    > client received these events attached to query results. So every
    > time a client performs a query (or executes a special polling
    > request) these events are received. Not quite so real-time, but
    > possibly useful in many circumstances.

    Yeah - that's another possible mechanism. The mechanics of it will be
    different. Unlike continuations approach, this will require a "delayed
    client queue".

    > 3. Are the events here just refresh query cache events, or are we
    > talking about 'invalidate record id 1234 from entity Artist'
    > messages? Possibly that will generate too much traffic since the
    > server will not know which clients have those entities already
    > cached and will have to propagate all invalidate messages to all
    > clients.

    Both types of events... (I guess each type can be suppressed or
    enabled via configuration). I forgot to mention one thing though - we
    already have per-object events (since Cayenne 1.1), but there is no
    query cache events (any such events are specific to an implementation
    of the QueryCache, and are not a part of Cayenne). So that's something
    that we need to design.

    > I'm still a little hazy about whether the server has a copy of the
    > same contexts as the client does, so perhaps it does know which
    > records the client is holding

    Yes - the server contains "peer" contexts of all client contexts,
    stored in HttpSession. Their state is almost the same as client's, the
    only difference being objects loaded during callbacks execution.

    Andrus



    This archive was generated by hypermail 2.0.0 : Thu May 15 2008 - 10:06:24 EDT