Integration / Akka interview questions
1. What is Akka?
Akka is a toolkit (not a framework) for building highly concurrent, distributed, and resilient message-driven applications for Java and Scala. Akka is the implementation of the Actor Model on the JVM.
2. What is Actor?
Actors are message driven, stateful building blocks. Messages are passed asynchronously.
3. What are reactive streams?
Reactive Streams is an initiative to provide a standard for asynchronous stream processing with non- blocking backpressure.
4. Difference between Java 9 Reactive streams versus Akka Streams.
Akka streams are created on top of Reactive streams so the terminology is different however the workflow/functionality resembles.
5. Can Akka be used instead of the Spring framework?
Akka is a toolkit, not a framework. This means that you use it together with Spring, Akka for structuring your runtime aspects (concurrency, parallelism, fault-handling) while the other for wiring together components.
6. What are the problems that the common programming practices face?
One of the OOPS principles, encapsulation, cannot be addressed efficiently without using locks which is expensive. Sharing memory/data using volatile markers or Atomic wrappers is a costly operation.
7. How the Actor Model addresses common programming practice issues?
Common programming practices do not properly address the needs of demanding modern, distributed systems. Use of actors model allows us to:, Enforce encapsulation without resorting to locks....
8. Components of an Actor.
Each Actor will have these component to achive the messaging behavior. mailbox , (the queue where messages end up) behavior (the state of the actor, internal variables, etc.)....
9. How Actors handle error situations gracefully?
When the delegated task on the target actor failed due to an error in the task, service actor will reply to the sender with a message about the error case. Akka enforces that all actors are organized into a tree-like...
10. Mention some of the Akka libraries that you are aware of/worked with.
Actor library , core Akka library that provides a consistent, integrated model that relieves you from individually solving the challenges that arise in concurrent or distributed system design. Remoting enables actors that live on different computers to seamlessly exchange messages....
11. Benefits of using the Actor model.
Event-driven model : Actors perform work in response to messages. Communication between Actors is asynchronous, allowing Actors to send messages and continue their own work without blocking to wait for a reply....
12. Should the actor messages be immutable?
Yes. Messages must be immutable as it is shared across different threads.
13. How do you instantiate an Actor?
You cannot create an instance of an Actor using the new keyword. Instead, you create Actor instances using a factory ( akka.actor.ActorSystem ) which does not return an actor instance, but a reference, akka.actor.ActorRef , that points to the actor...
14. Explain the Akka actor hierarchy.
An actor in Akka always belongs to a parent. getContext().actorOf() creates an actor and inject it as a child into an existing tree....
15. context.actorOf vs system.actorOf in Akka tool kit.
Both create actors however the difference lies where the actors are created in the actor tree hierarchy. Actors spawned with System.actorOf will be children of the guardian actor while the actors spawned with context.actorOf will be children of the context...
16. Akka actor life cycle hooks.
preStart () is invoked after the actor has started but before it processes its first message. postStop () is invoked just before the actor stops.
17. Different message delivery semantics.
At-most-once delivery : each message is delivered zero or one time, implies that messages can be lost, but are never duplicated. This is the default behavior which is cheap and produces high performance....
18. Advantages of using Akka model.
Simple and high-level abstractions for distribution, concurrency and parallelism. Asynchronous, non-blocking and highly performant message-driven programming model.
19. Is Actor system heavy weight?
Yes. ActorSystem is a heavyweight while Actor is light weight.
20. Different supervision strategies.
OneForOneStrategy (default). AllForOneStrategy.
21. What are the children of the root guardian?
/ user is the guardian actor for all user-created top-level actors; actors created using ActorSystem.actorOf are found below this one. / system is the guardian actor for all system-created top-level actors, e.g....
22. Can Actor beans be singleton when using Dependency injection (DI)?
No . Actor beans must not have singleton scope when using DI frameworks such as Spring, Guice etc.
23. Difference between tell and ask method in AKKA.
Both methods can be used to send messages to the actor. "tell" method send a message asynchronously and return immediately....