Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
427 views
in Technique[技术] by (71.8m points)

scala - 使用Akka Graph实现简单的架构(Implement simple architecture using Akka Graphs)

I'm attempting to setup a simple graph structure that process data via invoking rest services, forwards the result of each service to an intermediary processing unit before forwarding the result.

(我试图建立一个简单的图结构,该结构通过调用rest服务来处理数据,然后在转发结果之前将每个服务的结果转发给中间处理单元。)

Here is a high level architecture :

(这是一个高级架构:)

在此处输入图片说明

Can this be defined using Akka graph streams ?

(可以使用Akka图流定义它吗?)

Reading https://doc.akka.io/docs/akka/current/stream/stream-graphs.html I don't understand how to even implement this simple architecture.

(阅读https://doc.akka.io/docs/akka/current/stream/stream-graphs.html我什至不知道如何实现这种简单的体系结构。)

I've tried to implement custom code to execute functions within a graph :

(我试图实现自定义代码来执行图中的功能:)

package com.graph

class RestG {

  def flow (in : String) : String = {
    return in + "extra"
  }

}

object RestG {

  case class Flow(in: String) {

    def out : String = in+"out"
  }

  def main(args: Array[String]): Unit = {

    List(new RestG().flow("test") , new RestG().flow("test2")).foreach(println)

  }

}

I'm unsure how to send data between the functions.

(我不确定如何在函数之间发送数据。)

So I think I should be using Akka Graphs but how to implement the architecture above ?

(所以我认为我应该使用Akka Graph,但是如何实现上述架构?)

  ask by blue-sky translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...