难道阿卡obsolesce骆驼? [英] Does Akka obsolesce Camel?

查看:218
本文介绍了难道阿卡obsolesce骆驼?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的了解的阿卡的是,它提供了一个模型,即多个孤立线程可以在一个高度并行的方式彼此沟通。它采用了角色模型,其中每个线程是一个演员与特定的工作要做。您可以协调哪些消息获得通过哪个演员什么样的条件下。

My understanding of Akka is that it provides a model whereby multiple, isolated threads can communicate with each other in a highly concurrent fashion. It uses the "actor model", where each thread is an "actor" with a specific job to do. You can orchestrate which messages get passed to which actors under what conditions.

我以前使用过骆驼,对我来说,我觉得这有点失去了光彩/工具现在阿卡是那么成熟和有据可查的。据我了解,骆驼是关于企业的整合,也就是多个不同的系统整合在一起,一般的某种服务总线时尚。

I've used Camel before, and to me, I feel like it's sort of lost its luster/utility now that Akka is so mature and well documented. As I understand it, Camel is about enterprise integration, that is, integrating multiple disparate systems together, usually in some kind of service bus fashion.

不过,仔细想想:如果我现在使用的骆驼为:

But think about it: if I am currently using Camel to:


  • 投票FTP服务器的文件,一旦发现...

  • 变换该文件的内容转换成一个POJO,然后...

  • 发送一封电子邮件,如果POJO具有一定的状态,或者

  • 坚持了POJO到数据库中的所有其他情况下

我可以做阿卡同样的事情;我可以有1男演员为每个这些步骤(投票FTP,转换文件 - > POJO,电子邮件或坚持),电线在一起,让阿卡处理所有的异步/并行

I can do the exact same thing with Akka; I can have 1 Actor for each of those steps (Poll FTP, transform file -> POJO, email or persist), wire them together, and let Akka handle all the asynchrony/concurrency.

因此​​,即使是阿卡(使用演员)并发框架,尽管骆驼是关于融合,我要问:不能阿卡解决骆驼做的一切?在疗法的话:什么用例仍然存在使用过的骆驼阿卡

So even though Akka is a concurrency framework (using actors), and even though Camel is about integration, I have to ask: Can't Akka solve everything that Camel does? In ther words: What use cases still exist to use Camel over Akka?

推荐答案

阿卡和骆驼是两个不同的东西(除了一个是山路,一个是动物)。

Akka and Camel are two different beasts (besides one is a mountain and one is an animal).

您自己提到它:
阿卡是实现反应堆模式的一个工具,即潜在的分布式系统基于消息并发引擎。

You mention it yourself: Akka is a tool to implement the reactor pattern, i.e. a message based concurrency engine for potentially distributed systems.

骆驼是DSL / framwork实现企业集成模式。

Camel is a DSL/framwork to implement Enterprise Integration Patterns.

有很多的东西,这将是虽然阿卡pretty,这很容易在骆驼。交易是肯定的。然后所有的逻辑各种传输逻辑和选项,如阿卡不具有集成的消息的抽象。然后有发达的生态工业园是在骆驼大,组播,分割,聚集,XML / JSON处理,文本文件的解析,HL7,更何况一个只有几个。当然,你可以做到这一切在纯java /斯卡拉,但是这不是重点。问题的关键是要能够使用DSL,不再次执行基本逻辑来描述集成

There are a lot of things that would be pretty though in Akka, that is easy in Camel. Transactions for sure. Then all the logic various transport logic and options, as Akka does not have an abstraction for an integration message. Then there are well developed EIPs that are great in Camel, the multicast, splitting, aggregation, XML/JSON handling, text-file parsing, HL7, to mention a only a few. Of course, you can do it all in pure java/scala, but that's not the point. The point is to be able to describe the integration using a DSL, not to implement the underlying logic once again.

非少,阿卡连同骆驼是pretty有趣。尤其是使用Scala。那么你已经EIP对演员语义之上,这是正确的竞技场pretty强大。

Non the less, Akka TOGETHER with Camel is pretty interesting. Especially using Scala. Then you have EIP on top of the actor semantics, which is pretty powerful in the right arena.

从akka.io示例

import akka.actor.Actor
import akka.camel.{ Producer, Oneway }
import akka.actor.{ ActorSystem, Props }

class Orders extends Actor with Producer with Oneway {
  def endpointUri = "jms:queue:Orders"
}

val sys = ActorSystem("some-system")
val orders = sys.actorOf(Props[Orders])

orders ! <order amount="100" currency="PLN" itemId="12345"/>

一个全样本/教程可以在类型安全找到。

A full sample/tutorial can be found at typesafe.

这篇关于难道阿卡obsolesce骆驼?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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