[Lift] Re: Model Events
Thanks Peter, that pretty much answers my question! On 5 Okt., 01:17, Peter Robinett pe...@bubblefoundry.com wrote: Hi Gregor, For my Mapper model called Packet, my companion object looks like this: object Packet extends Packet with LongKeyedMetaMapper[Packet] { override def dbTableName = packets // define the DB table name /* register callback to send the new packet */ override def afterCreate = createdRow _ :: super.afterCreate private def createdRow(packet: Packet) { DatacenterBroker.createdPacket(packet) } } As you can see, after a Packet is created it is sent to an Actor (using the broker object as an intermediary). The Scaladocs for MetaMapper show many before and after events that you can override like I've done with afterCreate:http://scala-tools.org/mvnsites-snapshots/liftweb/lift-mapper/scalado... Peter Robinett On Oct 4, 10:47 pm, donfranciscodequevedo donfranciscodequev...@gmail.com wrote: Hi Marius, Thanks for your fast response. As an app developer, if I would like to get notified from the persistence layer, that some changes to my domain model have happened, how could I get such functionality with a Scala actor? By subclassing the persistence class? Or is such functionality already integrated in the persistence layer? Let's say I would like to get notified before some data is inserted in the database. How would I achieve that? Thanks again On 4 Okt., 20:37, marius d. marius.dan...@gmail.com wrote: Scala has a natural support for events notifications = Scala Actors. It's a very natural fit for building event driven systems. In Lift we're moving CometActors to LiftActors instead of Scala Actors due to some memory consumption problems with current Scala actors implementation which are probably fixed now in Scala 2.7.7 RC1. So definitely yes, event driven programming is quite fitful in Lift. Br's, Marius On Oct 4, 8:25 pm, donfranciscodequevedo donfranciscodequev...@gmail.com wrote: I have been looking for Web frameworks that will take advantage of an Event Driven programming model. Some Frameworks like Python's Zope and Grails manage to subscribe to Model Events. E.g. one can subscribe to a notification message, whenever a domain model gets changed, added, deleted, etc. (like explained here http://bit.ly/2AkVBy) Can the Lift Framework throw such events too? Similar to the way Grails and Zope do it? Or is there another way in Lift to do the same? I must say that I preety much do like the Lift Framework and it's fresh approach on important tasks like Comet, Templating, Active Record, Web Services, Localization... However one of my key requirements would be simple handling of events and notifications. Thank you Gregor --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[Lift] Re: Model Events
Glad to help. Peter On Oct 5, 11:29 am, donfranciscodequevedo donfranciscodequev...@gmail.com wrote: Thanks Peter, that pretty much answers my question! On 5 Okt., 01:17, Peter Robinett pe...@bubblefoundry.com wrote: Hi Gregor, For my Mapper model called Packet, my companion object looks like this: object Packet extends Packet with LongKeyedMetaMapper[Packet] { override def dbTableName = packets // define the DB table name /* register callback to send the new packet */ override def afterCreate = createdRow _ :: super.afterCreate private def createdRow(packet: Packet) { DatacenterBroker.createdPacket(packet) } } As you can see, after a Packet is created it is sent to an Actor (using the broker object as an intermediary). The Scaladocs for MetaMapper show many before and after events that you can override like I've done with afterCreate:http://scala-tools.org/mvnsites-snapshots/liftweb/lift-mapper/scalado... Peter Robinett On Oct 4, 10:47 pm, donfranciscodequevedo donfranciscodequev...@gmail.com wrote: Hi Marius, Thanks for your fast response. As an app developer, if I would like to get notified from the persistence layer, that some changes to my domain model have happened, how could I get such functionality with a Scala actor? By subclassing the persistence class? Or is such functionality already integrated in the persistence layer? Let's say I would like to get notified before some data is inserted in the database. How would I achieve that? Thanks again On 4 Okt., 20:37, marius d. marius.dan...@gmail.com wrote: Scala has a natural support for events notifications = Scala Actors. It's a very natural fit for building event driven systems. In Lift we're moving CometActors to LiftActors instead of Scala Actors due to some memory consumption problems with current Scala actors implementation which are probably fixed now in Scala 2.7.7 RC1. So definitely yes, event driven programming is quite fitful in Lift. Br's, Marius On Oct 4, 8:25 pm, donfranciscodequevedo donfranciscodequev...@gmail.com wrote: I have been looking for Web frameworks that will take advantage of an Event Driven programming model. Some Frameworks like Python's Zope and Grails manage to subscribe to Model Events. E.g. one can subscribe to a notification message, whenever a domain model gets changed, added, deleted, etc. (like explained here http://bit.ly/2AkVBy) Can the Lift Framework throw such events too? Similar to the way Grails and Zope do it? Or is there another way in Lift to do the same? I must say that I preety much do like the Lift Framework and it's fresh approach on important tasks like Comet, Templating, Active Record, Web Services, Localization... However one of my key requirements would be simple handling of events and notifications. Thank you Gregor --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[Lift] Re: Model Events
Scala has a natural support for events notifications = Scala Actors. It's a very natural fit for building event driven systems. In Lift we're moving CometActors to LiftActors instead of Scala Actors due to some memory consumption problems with current Scala actors implementation which are probably fixed now in Scala 2.7.7 RC1. So definitely yes, event driven programming is quite fitful in Lift. Br's, Marius On Oct 4, 8:25 pm, donfranciscodequevedo donfranciscodequev...@gmail.com wrote: I have been looking for Web frameworks that will take advantage of an Event Driven programming model. Some Frameworks like Python's Zope and Grails manage to subscribe to Model Events. E.g. one can subscribe to a notification message, whenever a domain model gets changed, added, deleted, etc. (like explained here http://bit.ly/2AkVBy) Can the Lift Framework throw such events too? Similar to the way Grails and Zope do it? Or is there another way in Lift to do the same? I must say that I preety much do like the Lift Framework and it's fresh approach on important tasks like Comet, Templating, Active Record, Web Services, Localization... However one of my key requirements would be simple handling of events and notifications. Thank you Gregor --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[Lift] Re: Model Events
Hi Marius, Thanks for your fast response. As an app developer, if I would like to get notified from the persistence layer, that some changes to my domain model have happened, how could I get such functionality with a Scala actor? By subclassing the persistence class? Or is such functionality already integrated in the persistence layer? Let's say I would like to get notified before some data is inserted in the database. How would I achieve that? Thanks again On 4 Okt., 20:37, marius d. marius.dan...@gmail.com wrote: Scala has a natural support for events notifications = Scala Actors. It's a very natural fit for building event driven systems. In Lift we're moving CometActors to LiftActors instead of Scala Actors due to some memory consumption problems with current Scala actors implementation which are probably fixed now in Scala 2.7.7 RC1. So definitely yes, event driven programming is quite fitful in Lift. Br's, Marius On Oct 4, 8:25 pm, donfranciscodequevedo donfranciscodequev...@gmail.com wrote: I have been looking for Web frameworks that will take advantage of an Event Driven programming model. Some Frameworks like Python's Zope and Grails manage to subscribe to Model Events. E.g. one can subscribe to a notification message, whenever a domain model gets changed, added, deleted, etc. (like explained here http://bit.ly/2AkVBy) Can the Lift Framework throw such events too? Similar to the way Grails and Zope do it? Or is there another way in Lift to do the same? I must say that I preety much do like the Lift Framework and it's fresh approach on important tasks like Comet, Templating, Active Record, Web Services, Localization... However one of my key requirements would be simple handling of events and notifications. Thank you Gregor --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[Lift] Re: Model Events
Hi Gregor, For my Mapper model called Packet, my companion object looks like this: object Packet extends Packet with LongKeyedMetaMapper[Packet] { override def dbTableName = packets // define the DB table name /* register callback to send the new packet */ override def afterCreate = createdRow _ :: super.afterCreate private def createdRow(packet: Packet) { DatacenterBroker.createdPacket(packet) } } As you can see, after a Packet is created it is sent to an Actor (using the broker object as an intermediary). The Scaladocs for MetaMapper show many before and after events that you can override like I've done with afterCreate: http://scala-tools.org/mvnsites-snapshots/liftweb/lift-mapper/scaladocs/net/liftweb/mapper/MetaMapper.html Peter Robinett On Oct 4, 10:47 pm, donfranciscodequevedo donfranciscodequev...@gmail.com wrote: Hi Marius, Thanks for your fast response. As an app developer, if I would like to get notified from the persistence layer, that some changes to my domain model have happened, how could I get such functionality with a Scala actor? By subclassing the persistence class? Or is such functionality already integrated in the persistence layer? Let's say I would like to get notified before some data is inserted in the database. How would I achieve that? Thanks again On 4 Okt., 20:37, marius d. marius.dan...@gmail.com wrote: Scala has a natural support for events notifications = Scala Actors. It's a very natural fit for building event driven systems. In Lift we're moving CometActors to LiftActors instead of Scala Actors due to some memory consumption problems with current Scala actors implementation which are probably fixed now in Scala 2.7.7 RC1. So definitely yes, event driven programming is quite fitful in Lift. Br's, Marius On Oct 4, 8:25 pm, donfranciscodequevedo donfranciscodequev...@gmail.com wrote: I have been looking for Web frameworks that will take advantage of an Event Driven programming model. Some Frameworks like Python's Zope and Grails manage to subscribe to Model Events. E.g. one can subscribe to a notification message, whenever a domain model gets changed, added, deleted, etc. (like explained here http://bit.ly/2AkVBy) Can the Lift Framework throw such events too? Similar to the way Grails and Zope do it? Or is there another way in Lift to do the same? I must say that I preety much do like the Lift Framework and it's fresh approach on important tasks like Comet, Templating, Active Record, Web Services, Localization... However one of my key requirements would be simple handling of events and notifications. Thank you Gregor --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---