可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
Right now I'm looking at Play Framework and like it a lot. One of the parts heavy advertised amongst the features offered in Play is Akka.
In order to better understand Akka and how to use it properly, can you tell me what are the alternatives in other languages or products?
How does RabbitMQ compare to it? Is there a lot of overlap? Is it practical using them together? IN what use cases?
回答1:
The best place to start is a great Akka official documentation. I think the closest product/framework to Akka is erlang language. I guess (I haven't used Play framework) Akka is used there to implement Comet and other asynchronous processing.
rabbitmq is somewhat similar in ideas (infrastructure for sending messages), note that RabbitMQ is even written in erlang, but they have slightly different use-cases. I would say that while RabbitMQ focuses on message passing, Akka is more about actors (message receivers and senders).
回答2:
I use RabbitMQ + Spring AMQP + Guava's EventBus to automatically register Actor-like messengers using Guava's EventBus for pattern matching the received messages.
The similarity to Spring AMQP and Akka is uncanny. Spring AMQP's SimpleMessageListenerContainer + MessageListener is pretty much equivalent to an Actor.
However for all intents and purposes RabbitMQ is more powerful than Akka in that it has many client implementations in different languages, provides persistence (durable queues), topological routing and pluggable QoS algorithms.
That being said Akka is way more convenient and in theory Akka can do all of the above and some people have written extensions but most just use Akka and then have Akka deliver the messages over RabbitMQ. Also Spring AMQP SimpleMessageListener container is kind of heavy and its unclear what would happen if you created a couple of million of them.
In hindsight I would consider using Akka to RabbbitMQ instead of Spring AMQP for future projects.
回答3:
The best advice I can offer, as I also went through the same thought process when Play 2.0 joined Typesafe and started to use Akka more, is to search for "Actor model".
Wikipedia is a great resource - http://en.wikipedia.org/wiki/Actor_model. It has a list of programming languages that can support the actor model, and also has a list of frameworks (including Akka) that are based on the Actor model.
Put simply, the Actor model is based around the concept of actors in a concurrent computation model. Actors doesn't necessarily mean passing of messages, but most common use cases will have actors passing messages (which is where the similarities with rabbitMQ will come in).
回答4:
Akka is a toolkit and runtime for building concurrent & distributed systems. To achieve this, Akka use Actor model. If you are looking for an alternative for Akka, i think you can not find a complete solution like Akka, because Akka have several features that enable you to develop robust concurrent & distributed system:
- Akka actor
- Actor Routing, Supervising and Monitoring
- Asynchronous and non-blocking messaging
- Akka Cluster (for cluster management)
- Akka persistence (for implementing Event sourcing, persistence actor and At-Least-Once Delivery messaging)
- Akka I/O (for TCP & UDP communication)
- Akka HTTP (for HTTP communication as client or server)
- Akka Stream (for stream processing)
- ...
But i suggest to take a look at Erlang/OTP and Quasar.
回答5:
http://scalecube.io is a low latency microservices lib .
a complete solution that enable you to develop robust concurrent & distributed system.
Like Akka:
- its based on gossip and swim protocol.
- its message driven based on protobuf (full duplex).
- its for the JVM.
- low latency and about ~6 times faster.
- uses RxJava proven to be faster than akka streams.
Unlike Akka:
- its less opinionated
- not a framework.
- not forcing Actor pattern as holistic pattern.
回答6:
You can also consider use Vertx, which is also a Reactive platform http://vertx.io/
Where there you can consider the Verticle(http://vertx.io/docs/vertx-core/java/#_verticles) similar to Actor paradigm.
And the EventBus similar as Databus of Akka(http://vertx.io/docs/vertx-core/java/#event_bus)