Actor Proxy API
remeniuk edited this page Oct 28, 2010
·
9 revisions
var actorProxy = actors.createActorProxy('10.6.122.29', 12345, 'server')
Creates proxy to Scala RemoteActor. Communication is done via Actor's server socket:
hostname - actor's node host
port - actor's node port
actorName - actor's name alias (converted to Symbol in Scala)
##ActorProxy.send(fcqn, message)
actorProxy.send(
'com.vasilrem.remote.protocol.RemoteActorProtocol$StringMessage',
StringMessage.serialize({
message: 'Message from node.js!'
}))
Asynchronously sends message to the actor
fqcn - FQCN of the message's Java protocol stub
message - message serialized into protobuf ##ActorProxy.receive(handler)
actorProxy.receive({
'com.vasilrem.remote.protocol.RemoteActorProtocol$StringMessage': function(data){
console.log('Remote actor responded with: ' + StringMessage.parse(data).message)
}
})
Receives response from the actor
handler - stub's FQCN->function mapping