简体   繁体   中英

Porting python-twisted based code to scala: framework advice needed

I am trying to port a significant amount of code written in python with twisted to scala, and I'm looking for opinions on what framework combination to choose.

The thing is essentially an RPC (custom protobuf-based + xmlrpc)/HTTP server and client, that does some database-keeping and transformations but later sends down rpcs to workers which are outside of the scope of this rewrite.

As a network IO/base for implementing RPC stack I am using netty. All the workflows in the old thingy were based on twisted's Deferred, and to replace it I'm currently considering either ChannelFuture directly, or wrapping it inside either scalaz.Promise or akka.Future.

I guess, one part of the question is - can it be done simpler than manually working with callbacks? I guess, if I choose this route, I can simplify it later by adding some wrappers and using continuations, but maybe I need to use something different from the beginning?

I tried to fit the workflow inside actor model but it doesn't seem to work with stdlib actors.

Thanks.

Update: Finagle seems to be modeled closely after, or at least accidentally similar, to twisted. twitter.util.Future looks a lot like twisted's Deferred. So I'm using it for the moment.

Update 2: The reasons why I ported it in the first place are static typing and performance.

Finagle seems to be modeled closely after, or at least accidentally similar, to twisted. twitter.util.Future looks a lot like twisted's Deferred. So I'm using it for the moment.

Have a look at this link .

It is a blog post on performance comparison between Scala and Python + Twisted. His code (or his advice) might be useful to you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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