On Tue, Jul 21, 2009 at 2:04 PM, Peter Robinett <pe...@bubblefoundry.com>wrote:

>
> Hi David,
>
> I'm looking to use your code in my application but first I wanted to
> ask you about Scala Actors versus LiftActors. I see you use the Scala
> ones here. Why is that? Would it be better to use your Lift ones? I'm
> expecting object creation in my app every few seconds and when
> responding it would like to update Flot charts and various other
> components using Comet.


The issue with Scala Actors is the number of Actor creation/destruction
operations.  You'll create an Actor per session... not a lot of cycling.

I'd go with Scala Actors.


>
>
> Thanks for your advice,
> Peter Robinett
>
> On Jul 9, 2:36 pm, David Pollak <feeder.of.the.be...@gmail.com> wrote:
> > On Mon, Jul 6, 2009 at 7:56 AM, Tobias Daub <hannes.flo...@gmx.li>
> wrote:
> >
> > > Hi List,
> >
> > > I wanna send a message to an Actor everytime a new "row" is created in
> a
> > > specific table. The Actor is responsible to refresh a HTML page and
> > > display all the items from the table.
> >
> > > How do I do that?
> >
> > In the Meta object for the model you want to track, override afterCreate
> to
> > call a method that sends the row to an Actor:
> >
> > object Dog extends Dog with LongKeyedMetaMapper[Dog] with CRUDify[Long,
> Dog]
> > {
> >   override def afterCreate = createdRow _ :: super.afterCreate
> >
> >   private def createdRow(r: Dog) {
> >     DogBroker ! r
> >   }
> >
> > }
> >
> > The actor redistributes the update to all its listeners:
> >
> > object DogBroker extends Actor with ListenerManager {
> >   var latestDog: Box[Dog] = Empty
> >
> >   def createUpdate = latestDog
> >
> >   override def highPriority = {
> >     case d: Dog =>
> >       latestDog = Full(d)
> >       updateListeners()
> >   }
> >
> >   this.start
> >
> > }
> >
> > And the comet component looks like:
> >
> > class Woof extends CometActor with CometListener {
> >   private var dog: Box[Dog] = Empty
> >
> >   def render = <div>Dog: {dog.map(_.toString) openOr "None"}</div>
> >
> >   def registerWith = DogBroker
> >
> >   override def highPriority = {
> >     case Full(d: Dog) =>
> >       dog = Full(d)
> >       reRender(false)
> >   }
> >
> > }
> >
> > The full running source can be found athttp://
> github.com/dpp/lift_1_1_sample/tree/record_ping
> >
> > Thanks,
> >
> > David
> >
> >
> >
> > > thanks.
> >
> > --
> > Lift, the simply functional web frameworkhttp://liftweb.net
> > Beginning Scalahttp://www.apress.com/book/view/1430219890
> > Follow me:http://twitter.com/dpp
> > Git some:http://github.com/dpp
> >
>


-- 
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Git some: http://github.com/dpp

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to