Akka中的Dispatcher和Routers之间的区别

编程入门 行业动态 更新时间:2024-10-07 10:24:28
本文介绍了Akka中的Dispatcher和Routers之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在浏览Akka文档&其他维基。谁能告诉我Dispatcher& and之间的区别是什么? Akka框架中的路由器?

I am going through akka documentation & other wiki's. Can anyone tell me what is the difference between Dispatcher & Routers in Akka framework?

推荐答案

Dispatcher 和路由器是Actor系统的两个不同概念。调度程序基本上是一个线程池,这意味着可以使用调度程序执行任意代码,当然,您可以自定义线程池的配置(在fork-join池和线程执行程序之间进行选择,设置最大/最小并行度,请检查默认的 dispatcher conf reference.conf )。虽然路由器一词与部署过程有关,并且指定了将消息路由到路由列表的路由逻辑,但是您可以在其中为池/组选择合适的策略(例如RoundRobin,Broadcast等),指定路由器路径(对于

Dispatcher and Routers are two different concepts of Actor System. A dispatcher is basically a thread-pool, which means that dispatchers can be used to execute arbitrary code, of course, you can customize a configuration of thread pool (select between fork-join pool and thread executor, set up max/min parallelism level, check default dispatcher conf reference.conf ). While term "Routers" is related to deployment process and specifying routing logic to route messages to a list of routees, where you can select a suitable strategy for pool/group (like RoundRobin, Broadcast, etc.), specify router paths (for a group).

来自规范:

路由:消息可以通过以下方式发送:路由器有效地将路由到目的地演员,称为路由。

Routing: Messages can be sent via a router to efficiently route them to destination actors, known as its routees.

Dispatcher是Akka Actors的代号,是引擎的引擎可以这么说,机器可以用来执行任意代码,例如实例期货

Dispatcher is what makes Akka Actors "tick", it is the engine of the machine so to speak, they can be used to execute arbitrary code, for instance Futures

可以看到,它们都对Actor系统的绝对不同部分负责,但是您可以将它们两者组合在一起以定制相同的actor系统配置。有关更多详细信息,请参见文章。 HTH

As you see, both of them are responsible for an absolutely different part of Actor System, but you can combine both of them for customization of the same actor system configuration. For more details, check this article. HTH

更多推荐

Akka中的Dispatcher和Routers之间的区别

本文发布于:2023-11-25 06:21:37,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1628653.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:区别   Akka   Dispatcher   Routers

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!