Does Akka obsolesce Camel?

前端 未结 1 2027
情深已故
情深已故 2021-02-13 11:10

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 \"ac

相关标签:
1条回答
  • 2021-02-13 11:24

    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.

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

    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.

    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.

    Example from 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.

    0 讨论(0)
提交回复
热议问题