Finagle

Is there a simple way to specify a global dependency exclude in SBT

廉价感情. 提交于 2020-05-24 21:06:07
问题 How would you exclude a transitive dependency globally? My project depends on a lot of the Twitter libraries or on libraries that depend on the Twitter libraries. I don't want slf4j-jdk14 in my classpath, no matter what (I use logback as slf4j binding). Currently I do this: "com.twitter" %% "finagle-thriftmux" % "6.16.0" exclude("org.slf4j", "slf4j-jdk14") but every time someone adds another dependency that uses slf4j-jdk14 I might get it back into the classpath. 回答1: Since sbt 0.13.8 In sbt

Finagle No asyncronous executing

落爺英雄遲暮 提交于 2019-12-13 07:22:05
问题 i have a simple finagle thrift server: import com.twitter.finagle.Thrift import scala.concurrent.Future import com.twitter.util.{ Await, Future } object Main{ def main(args: Array[String]) { var count = 0 val myserver = Thrift.serveIface("0.0.0.0:9090", new RealTimeDatabasePageImpressions[com.twitter.util.Future] { def saveOrUpdate(pageImpression: PageImpressions): com.twitter.util.Future[Boolean] = { count += 1 println(count) com.twitter.util.Future.value(true) } } Await.ready(myserver) } }

How to put a byte array into XML in Scala

核能气质少年 提交于 2019-12-12 10:15:03
问题 I'm interacting with a .Net web service. According to the service description the server is expecting a base64Binary type. This is how I'm trying to build the SOAP packet: <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Header> </soap:Header> <soap:Body> <uploadFile xmlns="http://localhost/"> <FileDetails> <ReferenceNumber>123</ReferenceNumber> <FileName>testfile<

Twitter的RPC框架Finagle简介

孤人 提交于 2019-12-09 20:58:05
Finagle是Twitter基于Netty开发的支持容错的、协议无关的RPC框架,该框架支撑了Twitter的核心服务。来自Twitter的软件工程师Jeff Smick撰文详细描述了该框架的工作原理和使用方式。 在Jeff Smick的博客文章中,介绍了Twitter的架构演进历程。Twitter面向服务的架构是由一个庞大的Ruby on Rails应用转化而来的。为了适应这种架构的变化,需要有一个高性能的、支持容错的、协议无关且异步的RPC框架。在面向服务的架构之中,服务会将大多数的时间花费在等待上游服务的响应上,因此使用异步的库能够让服务并发地处理请求,从而充分发挥硬件的潜能。Finagle构建在Netty之上,并不是直接在原生NIO之上构建的,这是因为Netty已经解决了许多Twitter所遇到的问题并提供了干净整洁的API。 Twitter构建在多个开源协议之上,包括HTTP、Thrift、Memcached、MySQL以及Redis。因此,网络栈需要足够灵活,以保证能与这些协议进行交流并且还要具有足够的可扩展性以支持添加新的协议。Netty本身没有与任何特定的协议绑定,对其添加协议支持非常简单,只需创建对应的事件处理器(event handler)即可。这种可扩展性产生了众多社区驱动的协议实现,包括SPDY、PostrgreSQL、WebSockets

convert Scala Future to Twitter Future

半世苍凉 提交于 2019-12-09 10:13:58
问题 I use Finagle as a web server which I want to return Scala-Futures from my application logic. How to convert scala.concurrent.Future to com.twitter.util.Future, in a non-blocking way of course? 回答1: Have not enough environment to test this, but here is what i write for "com.twitter" %% "finagle-http" % "6.25.0" : import com.twitter.{util => twitter} import scala.concurrent.{ExecutionContext, Promise, Future} import scala.util.{Failure, Success, Try} import language.implicitConversions object

How to put a byte array into XML in Scala

倾然丶 夕夏残阳落幕 提交于 2019-12-07 05:37:26
I'm interacting with a .Net web service. According to the service description the server is expecting a base64Binary type. This is how I'm trying to build the SOAP packet: <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Header> </soap:Header> <soap:Body> <uploadFile xmlns="http://localhost/"> <FileDetails> <ReferenceNumber>123</ReferenceNumber> <FileName>testfile</FileName> <FullFilePath>file</FullFilePath> <FileType>1</FileType> <FileContents>{request.getContent()

Write a thrift server in scala using scrooge and client in python or ruby

冷暖自知 提交于 2019-12-06 04:54:24
问题 I want to write a thrift service implementation in Scala (using Scrooge) but without the use of Finagle, since I couldn't write a ruby/python client for Finagle servers. The problem is that with scrooge the service doesn't seem to implement "Processor" class. Assume I have a thrift definition like this: service TestService { void testFunction(1: string message); } and I generated the scala files using scrooge, when I tried to use the standard implementation of thrift for scala with that to

Boundaries between Services, Filters, and Codecs in Finagle

会有一股神秘感。 提交于 2019-12-03 07:30:57
问题 Netty, which is used within Finagle, uses a pipeline of "handlers" to sequentially process in and out bound data. Netty examples, and included libraries, show various handlers used for things such as authentication, protocol codecs, and the actual business logic of the service. Finagle appears to take the handler concept, and instead directly offer API users codecs, filters, and services. While these have varying signatures, new users of Finagle are left with the tasks of deciding which to

What are advantages of a Twitter Future over a Scala Future?

早过忘川 提交于 2019-12-03 04:25:33
问题 I know a lot of reasons for Scala Future to be better. Are there any reasons to use Twitter Future instead? Except the fact Finagle uses it. 回答1: Disclaimer: I worked at Twitter on the Future implementation. A little bit of context, we started our own implementation before Scala had a "good" implementation of Future . Here're the features of Twitter's Future : Some method names are different and Twitter's Future has some new helper methods in the companion. e.g. Just one example: Future.join

在Scala中构建Web API的4大框架

会有一股神秘感。 提交于 2019-11-27 19:56:17
Scala是一种强大的语言,很快就成为许多开发人员的最爱。然而,语言只是一个起点-并非每个函数都将由语言核心覆盖。Scala还创建了一些厉害的框架。接下来看看Scala的4个强大框架以及其优点和缺点。请记住,框架的最佳选择总是应符合您特定项目的要求——因此,请酌情考虑我们的推荐,根据您自己的项目要求决定最适合您的项目。   Play Framework   —— Java和Scala的高速Web框架请添加链接描述   Play Framework是一个开源的Scala框架,于2007年首次发布。它目前由Lightbend,Zengularity及其用户开发人员社区开发。该框架的核心功能基于利用JVM及其相关库来构建RESTful应用程序。它目前被一些相当大的名称网站使用,包括LinkedIn,三星的IoT Artik平台和教育网站Coursera。在撰写本文时,Play 2.6是Play的当前版本,已在开发中取代了Play 1。     优点   1.与JVM密切相关,因此,Java开发人员会发现它很熟悉且易于使用。   2.广泛支持各种工具集和IDE系统。   3.它完全基于函数式编程概念,并促进了API优先的RESTful设计实践。   4.Play 2是被动的,允许并行远程呼叫。这意味着它适用于WebSockets和其他相关的以服务器为中心的方法。   5.它为资产汇编