简体   繁体   English

如何使用Akka actor处理Java中的套接字?

[英]How to handle sockets in Java with Akka actors?

I found tons of examples how to handle sockets in Scala with Akka actors, but there is no IO in the Java API. 我发现了无数示例,说明如何使用Akka actor在Scala中处理套接字,但是Java API中没有IO。 How should I use sockets in Java from within an Akka actor? 我应该如何在Akka actor中使用Java中的套接字? Is there any wrapper around sockets that makes possible to communicate with the sockets using messages? 套接字周围是否有包装器,可以使用消息与套接字进行通信?

The IO module only provides an api for Scala. IO模块仅为Scala提供api。 The IOManager may not be too hard to use from Java, you just have to handle the case classes it sends for each event type. 从Java使用IOManager可能不会太难,您只需处理它为每种事件类型发送的案例类。 The IO.Iteratee would probably be trickier to use from Java code, so you might just avoid using that. 从Java代码中使用IO.Iteratee可能会比较棘手,因此您可以避免使用它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM