hello scala

An introduction to Akka Actors

Table of Contents1 - An Akka “Hello, world” example2 - A second example3 - More examples4 - Where Akka fits in5 - Source code6 - Key points7 - See also

This is an excerpt from my book, Hello, Scala. In this lesson I’ll show two examples of applications that use Akka actors, both of which can help you get started with my larger “Alexa written with Akka” = Aleka application.

Back to top

An Akka “Hello, world” example

First, let’s look at an example of how to write a “Hello, world” application using Akka.

Writing a “Hello” actor

An actor is an instance of the akka.actor.Actor class, and once it’s created it starts running on a parallel thread, and all it does is respond to messages that are sent to it. For this “Hello, world” example I want an actor that responds to “hello” messages, so I start with code like this:

Hello, Scala (free preview)

Note: The print version of Hello, Scala on Amazon will be going up to $20 (USD) this Saturday, April 13, 2019. It’s currently just $10, so you know, buy it while it’s on sale and all that. :)

If you like free things, here’s a link to a free preview (PDF) of the new version of my book, “Hello, Scala.” The book is 257 pages long, and the free preview contains the first 120 pages of it, so I hope it’s a significant preview.

July, 2019 Update: Hello, Scala was previously available in PDF and Kindle versions, but hopefully there are some big changes coming, so those versions are no longer for sale.

We Said Hello, Goodbye (Don’t Look Back)

Sorry I haven’t written much this week, I’ve been working on designs for the cover of a new book. But I can share one thing, my favorite song of the week, We Said Hello, Goodbye (Don’t Look Back), by Phil Collins. Some of the lyrics:

Well it really don’t matter much where you are
’cause home is in your heart
It’s a feeling that you wake with one day
Some people keep running all of their life
And still find they haven’t gone too far
They don’t see it's the feeling inside
The feeling inside.

“Hello, Scala” on sale for $10 (paperback) alvin March 5, 2019 - 8:16pm

March 5, 2019: For a limited time only, I put the paperback version of “Hello, Scala” on sale for $10 (US) on Amazon.

P.S. - It won’t get any cheaper than this.

Hello, Scala book (an introduction to Scala book)

July, 2019: Hello, Scala, is now available only in print form:

It was previously available in PDF and Kindle format, but there are some big changes planned, so those versions have been removed for the time being.

As the subtitle of the book shows, the purpose of this book is to help you learn the Scala programming language with small, easy lessons. The book consists of a little over 50 lessons, and it’s 258 pages long.

The paperback version of “Hello, Scala” is now available alvin September 9, 2018 - 9:39pm

The paperback version of “Hello, Scala” is now available. The regular price of the book will be $25, but it’s introductory price is $17.76. Click here to view the book information on Amazon.

The PDF version of Hello, Scala is now available alvin September 8, 2018 - 7:17pm

The PDF version of Hello, Scala is now available here on Gumroad.com. The regular price will be $20, but it’s currently on sale for just $10.

Updates for “Hello, Scala”

This page contains updates for my book, Hello, Scala. As I find good, new resources related to the book I’ll share them here, along with errata related to the book.

(No updates yet.)