Tuesday, July 21, 2020

Akka Toolkit

Akka is a free and open-source toolkit and runtime simplifying the construction of concurrent and distributed applications on the JVM.

Akka supports multiple programming models for concurrency, but it emphasizes actor-based concurrency, with inspiration drawn from Er-lang.

Akka handles all of the underlying threading complexities by allowing you to just focus on dividing your tasks into actors, defining messages to pass among actors, and wiring together their communication logic.

The real power of Akka is realized when you distribute actors across multiple machines.

Akka folows Actor Model.

In the actor model, the actor is represented as an individual entity. 
Some characteristics of the actor are as follows:
  • Actor encloses the state and application logic
  • Actor interacts only using messages.
  • Every actor has an exclusive address and mailbox through which he can receive messages from others.
  • Mailbox messages are processed by the actor in consecutive order.
  • Tree hierarchy is used to represent the actor system.
Benefits of using the Actor Model:
The following characteristics of Akka allow you to solve difficult concurrency and scalability challenges in an intuitive way:
  • 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.
  • Strong isolation principles — Unlike regular objects in Java, an Actor does not have a public API in terms of methods that you can invoke. Instead, its public API is defined through messages that the actor handles. This prevents any sharing of state between Actors; the only way to observe another actor’s state is by sending it a message asking for it.
  • Location transparency — The system constructs Actors from a factory and returns references to the instances. Because location doesn’t matter, Actor instances can start, stop, move, and restart to scale up and down as well as recover from unexpected failures.
  • Lightweight — Each instance consumes only a few hundred bytes, which realistically allows millions of concurrent Actors to exist in a single application.
Akka Actors:
  • Ask Pattern
  • Ask Pattern mapTo
  • Ask Pattern pipeTo
  • Actor Hierarchy
  • Actor Lookup
  • Child actors
  • Actor Lifecycle
  • Actor PoisonPill
  • Error Kernel Supervision
Akka Routers:
  • RoundRobinPool
  • ScatterGatherFirstCompletedPool
  • TailChoppingPool
  • BroadcastPool
Akka Dispatchers:
  • Akka Default Dispatcher
  • Akka Lookup Dispatcher
  • Fixed Thread Pool Dispatcher
  • Resizable Thread Pool Dispatcher
  • Pinned Thread Pool Dispatcher

Akka HTTP: 

As the name implies, this module is typically best suited for middle-tier applications which require an HTTP endpoint. As an example, you could use Akka HTTP to expose a REST endpoint that interfaces with a storage layer such as a database. For additional information, you can refer to the official Akka documentation on Akka HTTP.


Akka Streams:

This module is useful when you are working on data pipelines or even stream processing. For additional information, you can refer to the official Akka documentation on Akka Streams.


Akka Networking:

This module provides the foundation for having actor systems being able to connect to each other remotely over some predefined network transport such as TCP. For additional information, you can refer to the official Akka documentation on Akka Networking.


Akka Clustering:

This module is an extension of the Akka Networking module. It is useful in scaling distributed applications by have actors form a quorum and work together by some predefined membership protocol. For additional information, you can refer to the official Akka documentation on Akka Clustering.


For Creating a Simple Application,use the below link

https://developer.lightbend.com/start/?group=akka&project=akka-quickstart-java




 

No comments:

Post a Comment

ES12 new Features