ScalangScala 的封装

联合创作 · 2023-10-01

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?")
浏览 7
点赞
评论
收藏
分享

手机扫一扫分享

编辑
举报
评论
图片
表情
推荐
点赞
评论
收藏
分享

手机扫一扫分享

编辑
举报