Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

general
http

What is Akka HTTP?

Sarvech Qadir

Akka HTTP is a series of modules that implement a server-side and client-side HTTP stack. It is a general toolkit for providing and consuming HTTP-based services.

Any interaction with a browser is part of these modules; however, it is not Akka HTTP’s primary concern.

Uses

Akka HTTP offers several, different API levels, many of which are low-level APIs. A situation can arise where something may not be achieved using high-level APIs. One can then choose from the different APIs offered by Akka HTTP to find the most suitable API level of abstraction.

Akka is not a framework; rather, it is a suite of libraries. Its main focus is to provide tools for building integration layers rather than application cores. Akka HTTP is mostly used for making integration layers based on HTTP. A user can build the application based on their requirements, and Akka HTTP can be used to cater to the needs of HTTP integration.

Using Akka HTTP

Akka HTTP is provided in a separate .jar file. For users to use it, they need to make sure to include the following dependencies:

// If the user is running for, Akka 2.4.x or 2.5.x, they need to include it

"com.typesafe.akka" %% "akka-http" % "10.0.15" 
// If the user is running against,  Akka 2.5 is explicitly dependent on akka-streams, which are the same as akka-actor. They see and include the following dependecies.

"com.typesafe.akka" %% "akka-stream" % "2.5.8" 

// OR

"com.typesafe.akka" %% "akka-actor"  % "2.5.8" 
// or whatever the latest version is

Akka HTTP quickstart in Scala

Akka HTTP comes in two main modules: akka-http and akka-http-core. Since akka-http depends on akka-http-core, you don’t need to explicitly bring in the latter. Still, you may need to do this if you rely solely on the low-level API. So, make sure that the Scala version you are using is a recent release of version 2.11 or 2.12.

Alternatively, you can bootstrap a new sbt project with Akka HTTP already configured using the Giter8 template:

sbt -Dsbt.version=0.13.15 new https://github.com/akka/akka-http-scala-seed.g8

For more information, visit the official documentation.

RELATED TAGS

general
http

CONTRIBUTOR

Sarvech Qadir
Copyright ©2022 Educative, Inc. All rights reserved
RELATED COURSES

View all Courses

Keep Exploring