Akka或Reactor [英] Akka or Reactor

查看:304
本文介绍了Akka或Reactor的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开始一个新项目(基于java)。我需要将其构建为模块化,分布式和弹性架构。

I am in the process of starting a new project (java-based). I need to build it as a modular, distributed and resilient architecture.

因此,我希望业务流程能够相互通信,可互操作,还可以独立。

Therefore I would like to have the business processes to communicate among themselves, be interoperable, but also independent.

我现在正在寻找两个框架,除了它们的年龄差异外,还表达了两种不同的观点:

I am looking right now at two frameworks that, besides their difference in age, express 2 different views:

  • Akka (http://akka.io)
  • Reactor (https://github.com/reactor/reactor)

选择上述框架之一时我应该考虑什么?

What I should consider when choosing one of the above frameworks?

据我所知,至今为止,Akka仍然以某种方式耦合(在某种程度上我必须'选择'我想要发送消息的演员),但非常有弹性。虽然Reactor是松散的(基于事件发布)。

As far as I understand till now, Akka is still somehow coupled (in a way that I have to 'choose' the actor I want to send the messages to), but very resilient. While Reactor is loose (as is based on event posting).

有人可以帮我理解如何做出正确的决定吗?

Can someone help me understand how make a proper decision?

更新

在更好地审核 Event Bus ,我在某种程度上相信由Reactor表达的功能已包含在Akka中。

After reviewing better the Event Bus of Akka, I believe in some way the features expressed by Reactor are already included in Akka.

例如订阅和事件发布,记录在案在 https://github.com/reactor/reactor#events-selectors-and-消费者,可以在Akka中表达如下:

For example the subscription and event publishing, documented on https://github.com/reactor/reactor#events-selectors-and-consumers, can be expressed in Akka as following:

final ActorSystem system = ActorSystem.create("system");
final ActorRef actor = system.actorOf(new Props(
    new UntypedActorFactory() {

        @Override
        public Actor create() throws Exception {

            return new UntypedActor() {
                final LoggingAdapter log = Logging.getLogger(
                        getContext().system(), this);

                @Override
                public void onReceive(Object message)
                        throws Exception {
                    if (message instanceof String)
                        log.info("Received String message: {}",
                                message);
                    else
                        unhandled(message);
                }
            };
        }
    }), "actor");

system.eventStream().subscribe(actor, String.class);
system.eventStream().publish("testing 1 2 3");

因此,在我看来,两者之间的主要区别是:

Therefore it seems to me now that the major differences between the two are:


  • Akka,更成熟,绑定到Typesafe

  • Reactor,早期阶段,绑定到Spring

我的解释是否正确?但是概念上Akka中的Actor和Reactor中的Consumer之间的差异

Is my interpretation correct? But what is conceptually the difference between the Actor in Akka and the Consumer in Reactor?

推荐答案

它在这一点上很难说,因为Reactor仍然是一个草图,而我(Akka tech lead)并没有深入了解它的发展方向。看看Reactor是否成为Akka的竞争对手会很有意思,我们期待着这一点。

It is hard to tell at this point because Reactor is still a sketch and I (Akka tech lead) do not have insight into where it will go. It will be interesting to see if Reactor becomes a competitor to Akka, we are looking forward to that.

据我所知,从你的要求清单中可以找到Reactor弹性(即监督在Akka中为您提供的)和位置透明性(即以一种方式引用活动实体,使您可以通过本地或远程消息传递进行抽象;这是分布式所暗示的)。对于模块化,我对Reactor知之甚少,尤其是如何查找活动组件并对其进行管理。

As far as I can see, from your requirements list Reactor is missing resilience (i.e. what supervision gives you in Akka) and location transparency (i.e. referring to active entities in a fashion which lets you abstract over local or remote messaging; which is what you imply by "distributed"). For "modular" I do not know enough about Reactor, in particular how you can look up active components and manage them.

如果你现在开始一个真正的项目并需要一些东西满足你的第一句话,那么我认为在这一点上推荐Akka并不会引起争议(正如Jon所说)。随意在SO或 akka-user邮件列表中提出更具体的问题

If you start a real project now and need something which satisfies your first sentence, then I don’t think it would be controversial to recommend Akka at this point (as Jon also noted). Feel free to ask more concrete questions on SO or on the akka-user mailing list.

这篇关于Akka或Reactor的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆