Play framework with Akka Throttle for Output
1 AKKA Version
First of all, check with AKKA version I am using in play framework 2.4.3. I knew the version of AKKA really matters.
In my play framework project
> activator
activator> show compile:dependencyClasspath
It will list all the dependency jars.
akka-actor_2.10-2.3.13.jar
akka-slf4j_2.10-2.3.13.jar
So the version is AKKA 2.3.13.
2 Throttling Actor Messages
Add this in the dependency
"com.typesafe.akka" %% "akka-contrib" % "2.3.13",
Initiate the Akka as follow
val contextIOActor = Akka.system.actorOf(ContextIOActor.props, name = "contextio-actor")
val contextIOThrottler = Akka.system.actorOf(Props(classOf[TimerBasedThrottler], contextio_throttle msgsPer 60.second), name = "conetxt-io-throttler")
contextIOThrottler ! SetTarget(Some(contextIOActor))
Then all we need to do is to send message to the contextIOThrottler, it will just throttle that and redirect the message to target.
References:
http://stackoverflow.com/questions/31112397/print-akka-version-in-play-framework-2-4-1
http://doc.akka.io/docs/akka/2.3.13/contrib/throttle.html
http://letitcrash.com/post/28901663062/throttling-messages-in-akka-2
http://www.michaelpollmeier.com/akka-work-pulling-pattern/
http://www.michaelpollmeier.com/akka-work-pulling-pattern-to-throttle-work/
http://doc.akka.io/api/akka/2.3.13/index.html#akka.contrib.throttle.TimerBasedThrottler
https://github.com/jonasanso/throttling/blob/5102d35f9abdf0cb15732a1cef0e4c92c4cca59c/app/controllers/Application.scala
分享到:
相关推荐
This book starts by laying out the fundamentals required for writing functional and asynchronous applications and quickly introduces Play as a framework to handle the plumbing of your application....
play-zipkin-tracing:使用Zipkin为Play Framework和Akka提供分布式跟踪
Akka Guice 集成安装将以下内容添加到您的 build.sbt: resolvers += " release repository " at " ... 添加行(插件前面的数字是您播放应用程序内的加载顺序): 10000:akkaGuice.AkkaGuicePlugin在 Global.java 中...
使用 Actor 将 SignalR到 PlayFramework。 SignalJ(SignalR)是一个服务器到客户端和客户端到服务器的通信框架。 使用回退机制与浏览器通信。 首先尝试 websockets,然后服务器发送事件,最后长轮询。 还有其他几...
/home/ambantis/Documents/dev/play/play4jug/hello2akka/project [info] Set current project to hello2akka (in build file:/home/ambantis/Documents/dev/play/play4jug/hello2akka/) > compile 基于线程的并发 ...
Reactive Programming with Scala and Akka 英文mobi 本资源转载自网络,如有侵权,请联系上传者或csdn删除 本资源转载自网络,如有侵权,请联系上传者或csdn删除
Framework、Akka 和 Apache Spark,使用 Scala 语言。 产品积压 Bettercare4.me 产品待办列表 提供基于差距查找患者的搜索功能 在患者记分卡页面上添加差距摘要部分 添加可视化仪表板 患者年龄分布 带有饼图的 HEDIS...
Akka for Reactive Programming Chapter 5. Building Resilient Application with Akka Chapter 6. Akka Cluster Chapter 7. Finite State Machines with Akka Chapter 8. Akka Unit Testing Chapter 9. ...
Reactive.programming.with.scala.and.akka.pdf Reactive Programming with Scala and Akka
Akka in Action shows you how to build message-oriented systems with Akka. This comprehensive, hands-on tutorial introduces each concept with a working example. You’ll start with the big picture of ...
play-akka-cluster-websocket-chat 基于 Play Framework 2 (Java) 和 Akka 集群的多房间可扩展聊天这个集成 play 框架 2 应用程序(java)与 akka 集群的示例。 它提供了为规模系统添加新的播放节点的可能性。 当一...
Akka is written in Scala, which has become the programming language of choice for development on the Akka platform. Learning Akka aims to be a comprehensive walkthrough of Akka. This book will take ...
playsonify:一个自以为是的微框架,可帮助您使用Play Framework(或akka-http)构建实用的JSON API。
This compact book includes in-depth introductions to RxJava, Akka Streams, and Reactor, and integrates the latest related features from Java 9 and 11, as well as reactive streams programming with the...
Akka is a Scala-based toolkit that simplifies developing concurrent distributed applications.... The book concludes with practical advice on how to tune and customize a system built with Akka.
together we took the leap to build our first project with Scala and Akka. We reached out early to Jonas Bonér (creator of Akka) for help, and later found out that we were among the first-known ...
2016年2月出版的《Reactive Programming with Scala and Akka》,介绍了使用scala和akka构建响应式程序的相关技术,pdf格式
Akka Concurrency Framework
For fault-tolerance we adopt the “let it crash” model which the telecom industry has used with great success to build applications that self-heal and systems that never stop. Actors also provide ...