liveBook · Manning

Receptionist

As explained in Akka in Action, Second Edition

The Akka receptionist is a service registry that lets actors register under keys and lets other actors subscribe to discover those registrations.

The Akka receptionist is a system-wide service registry for discovering actors that are not children, initialization parameters, or message-passed references. Actors register under a typed ServiceKey, while subscribers receive notifications when registrations change. section 6.0 section 6.1

A typical discovery flow uses these operations:

  • Define a ServiceKey whose name and message type identify the service. section 6.1
  • Register an actor by sending Receptionist.Register with the key and actor reference. section 6.1
  • Subscribe with a message adapter, because receptionist listings belong to the receptionist API rather than the subscriber’s protocol. section 6.1
  • Handle each Receptionist.Listing to inspect the currently registered actors; use Find for a one-time lookup or Deregister when an actor leaves. section 6.1

Hotel concierge discovery

A HotelConcierge subscribes to goldenKey, a ServiceKey[VIPGuest.Command]. When VIP guests enter, they register themselves. The concierge receives a listing and logs each guest; later registrations produce listings containing the existing and new guests.

How Akka in Action, Second Edition covers it

How deep it goes
Explains typed registration, subscription, adapters, listings, lookup, and deregistration through runnable Scala examples.
Examples
Uses VIP hotel guests, a hotel concierge, ScalaTest assertions, log capture, and successive registration notifications.
What it assumes
Assumes Akka Typed actor protocols and references while teaching ServiceKey registration and receptionist listings through examples.
What you can do after
Apply it via Akka Typed’s Receptionist API to register, discover, subscribe to, and remove actors by ServiceKey.
How it connects
Connects ServiceKey and actor discovery with message adapters, group routers, pool routers, and routing strategies.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Akka in Action, Second Edition. The section links point to the parts of the book it draws on.