Hi,I found myself fighting with usual/actor calls mess and i started thinking of a good way to separate them... One possible solution is to name all remote methods special way e.g. starting with 'remote' but it's hard to enforce (only runtime reflection checks at app start or something like that).
Untyped actors are good in this sense - but they are not type safe.
Any ideas?--
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To post to this group, send email to akka...@googlegroups.com.
To unsubscribe from this group, send email to akka-user+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/akka-user?hl=en.
Is it just me or doesn't sound like a reinvention of EJBs with local interfaces, remote interfaces etc?
It sounds like you need a Datagrid. Normally you want to send logic to data and not data to logic, and you want to have a different datamodel for queries and one for commands.
A common problem is that people query objects instead of commanding them, the old "Tell, don't ask." OO principle.
Cheers,
V
The 'Remote queries' feature seems to be easy with the cake pattern. I can just create traits with additinal operations (queries) and mix them to the main class at instantiation ('server' actor creation).And my properties implementation seems almost done, now i just need to use your new TypedActor code to be able to create proxies for multiple interfaces.Usage looks like this (i'm including the code because i hope you can grasp my idea and either tell me if i'm missing something important or agree it's a cool and useful feature):class Player extends RemoteRecord {val id = property("333")val name = property("Joe")val position = property(Point(0, 0))override val remote = new RecordActor { // the remote interface, also includes hidden service methods used by propertiesdef moveTo(p: Point) {position.set(p) // direct setting of value}}}def main(args: Array[String]) {val p = new Player // let's pretend we got 'p' by a remote operation (and deserialization)
// just look at the following code, isn't it easy and readable while doing some cool things?p.position.addListener(new ChangeListenerActor[Point] { // actually this should be a TypedActor creation, then the new actorRef is passed to p's home node as a 'callback'
def onNewValue(value: Point) { println("----> " + value) } // we are not sending the handler itself anywhere, so no problems with closure serialization etc})println(p.position()) // no remote calls, the value is available locally after deserialization
p.position() = Point(1, 1) // position's update() method uses hidden methods from RecordActor to make this call send update to p's home nodep.remote.moveTo(Point(2, 2)) // and here is what i wanted in my first message in this thread - we clearly see that this call is remote}----------------Now if some operation (like getObjectAround of the map of movable objects i mentioned above) returns me 100 players and i want to get their names i will not do 100 remote calls. Because Player objects are serializable beans with an ActorRef (the 'remote' field) to execute remote operations when needed.I think my case is quite common and looks like the solution is quite easy. Don't you think the rich typed actor with properties can be a good tool in the akka toolset?
I'm asking because i'm not sure i'm good enough to support such a library myself. So i can either implement it for myself and use it in my project or we can work together to imrove it and add it to akka.
Thanks,Oleg.
--
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To post to this group, send email to akka...@googlegroups.com.
To unsubscribe from this group, send email to akka-user+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/akka-user?hl=en.
def main(args: Array[String]) {val p = new Player // let's pretend we got 'p' by a remote operation (and deserialization)
So p is a remote proxy TypedActor?
// just look at the following code, isn't it easy and readable while doing some cool things?p.position.addListener(new ChangeListenerActor[Point] { // actually this should be a TypedActor creation, then the new actorRef is passed to p's home node as a 'callback'but p.position would be a remote call no?
I think it needs some time as a stand alone project, to prove it's use for people, and if it's gaining adoption, we will consider moving it into Akka itself.I'm asking because i'm not sure i'm good enough to support such a library myself. So i can either implement it for myself and use it in my project or we can work together to imrove it and add it to akka.
Just be sure to write a ton of unit tests so you can verify what gets called remotely and what doesn't. :-)
Looks like i have to wait for future versions. Was hoping to get a working remote sample today (local-actor based one worked ok), only had serialization left to do. But i wasted too much time trying to implement it with the 'SOLID' 1.1 serialization interfaces (e.g. i was really surprised when i had to provide deserializer from the same class as its result).
So for now i'll have to go with something more basic like untyped actors.
--
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To post to this group, send email to akka...@googlegroups.com.
To unsubscribe from this group, send email to akka-user+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/akka-user?hl=en.
Why not just rely on Java Serialization for now?