ScalangScala 的封装
Scalang 是一个 Scala 的封装,可以轻松的编写服务来跟 Erlang 接口。
示例代码:
class MyProcess(ctx : ProcessContext) extends Process(ctx) {
override def onMessage(msg : Any) {
log.info("received %s", msg)
}
}
val pid = node.spawn[MyProcess]("my_process")
//send to the pid
node.send(pid, "hey there")
//send to the regname
node.send("my_process", "you wanna party?")
评论