[Neo4j] help ..Activity Streaming

David Montag david.montag at neotechnology.com
Fri Aug 27 11:43:21 CEST 2010


Hi Joseph,

The implementation of such a system would be highly dependent on your
architecture. But my gut feeling is that activity feed data is kind of
transient - it's not a big deal if it is lost. Its usage and access patterns
are also different from the data it originated from. That leads me to want
to keep that data separately. I like the approach with listening for events
and putting them on a queue (#2). You can then process this queue
asynchronously and add the event data to the appropriate user profile's
rotating backlog of activity items. Usually it doesn't matter if the
activity feed update lags a bit after the actual changes.

An option is to keep the activity data in the same Neo4j instance as the
data (#3), but it usually requires extra processing and uses resources that
could have be used to serve actual data from the graph (serving content fast
might be more important than having accurate activity feeds). Typically, the
use of activity data is separate from the use of the actual data. So your
queue processor could store it in a separate Neo4j store instead, where you
can do whatever processing you need, e.g. aggregation so that you get "a, b,
and c like this" rather than three separate "likes" updates.

Now, as I said initially, it all depends on your architecture and needs. If
you're Facebook, you might want to think a bit more about this :)  What is
your scope? Single server?

I'm afraid I didn't understand your option #1. To answer your question about
TransactionData, it's for one transaction. Check the javadocs for more
information.

David

On Fri, Aug 27, 2010 at 9:14 AM, Joseph George <josephgeorgek at gmail.com>wrote:

> Hi
>
> am working on social networking project and we are trying enable
> "Activity Streaming" [similar to facebook - wall posts/streaming or
> linkedin network updates ].
> Wanted to check what is the correct option. Currently we see 3 options
> Option 1 : Enable activity log - This provides master list of all
> activities aka events. seen a file called "active_tx_log"  under
> database directory : is there anything way we can enable log so that
> we can resue as  Event Master as described above Questions: Currently
> it is empty. How to enable this so that we can resue this  Event
> Master
> Option 2: Write own implementation of TransactionEventHandler and
> write to a event master as follows
>
> 1. Register TransactionEventHandler
>     registerTransactionEventHandler
>   SamTxEventHandler sambaashTxEventHandler = new SamTxEventHandler();
>                   graphDatabase.registerTransactionEventHandler(
> SamTxEventHandler );
> 2.  Implement custom Event Handler :
>   public class SamTxEventHandler implements TransactionEventHandler<Object>
> 3.  Monitor for property change or node creation/Update and push it
> external Event Master
>   public void afterCommit( TransactionData data, Object state )
>           { for ( PropertyEntry<Node> entry :
> data.assignedNodeProperties())
>               {String key = entry.key();
>                   Object value = entry.previouslyCommitedValue();
> //**write to a master external Event Master file or mysql table with
> activity info  and then run a scheduler that pickups .. ie pubsubhub..
>   **/
>   Question:TransactionData : is true for only current transaction.
> Will be persist history for all.
>
> Option 3: While searching came across :
>
> https://svn.neo4j.org/laboratory/users/mattias/activity-stream/src/main/java/org/neo4j/examples/activitystream/ActivityStreamExample.java
> : This example takes the approach of creating additional  event Nodes
> and pushes it to a list of events.
>
> Apprecate if you can suggest the right approach for us to proceed.
> thanks and regards
> Joseph
>
>
>
> --
> thanks and regards
> Joseph
> _______________________________________________
> Neo4j mailing list
> User at lists.neo4j.org
> https://lists.neo4j.org/mailman/listinfo/user
>


More information about the User mailing list