这个Akka.NET代码有什么问题?
问题描述:
我花了一些时间寻找Akka.NET F#API。找不到它,即使有很好的C#文档。我发现下面的代码,日期为2017年3月,看起来不错,但不幸的是,当我尝试运行它时会生成一个异常。这个Akka.NET代码有什么问题?
两个问题:
1)下面的代码有什么问题?
2)是否有Akka.Net F#API的在线文档,如果是,它在哪里?
观察:我尝试了几个其他我在网上找到的F#Akka.NET片段,并且它们都产生了异常。
的代码的网址是:
https://www.seventeencups.net/building-a-mud-with-f-sharp-and-akka-net-part-one/
这里是我试图运行代码:
open System
open Akka.Actor
open Akka.Configuration
open Akka.Remote
open Akka.FSharp
let system = System.create "system" (Configuration.defaultConfig())
type GreeterMsg =
| Hello of string
| Goodbye of string
let greeter = spawn system "greeter" <| fun mailbox ->
let rec loop() = actor {
let! msg = mailbox.Receive()
match msg with
| Hello name -> printf "Hello, %s!\n" name
| Goodbye name -> printf "Goodbye, %s!\n" name
return! loop()
}
loop()
异常消息包括以下内容:
System.TypeLoadException: Method 'WatchWith' in type '[email protected]' from assembly 'Akka.FSharp, Version=1.2.3.41, Culture=neutral, PublicKeyToken=null' does not have an implementation
答
在您使用Akka.FSharp v1.2.3时,已经在Akka.NET v1.3中引入了方法。您需要将您的Akka依赖关系降级到1.2.3(此时Akka.FSharp在v1.3中尚未提供)。
它的工作!你有没有一个URL可以让我获得关于Akka.FSharp API的更多信息?有一个链接,但如果你点击它,你会得到这样的消息:'你正在寻找的资源已被删除,名称已更改或暂时不可用。' –
Soldalma
Akka.FSharp API本质上是一个文件,本身没有文档。还有一个替代API(https://github.com/Horusiath/Akkling),其中有github wiki页面。但是,该API更流畅,并且可能随时间而改变。 – Horusiath
谢谢@horusiath。涉及到FSharp API时,您会有很多帮助。 – himekami