liveBook · Manning

ServiceKey

As explained in Akka in Action, Second Edition

ServiceKey is an Akka Typed identifier used to register and discover actors that provide a particular service protocol.

A ServiceKey is an Akka Typed identifier for registering and discovering actors that provide a particular service protocol. Its name and protocol type together distinguish one key from another. section 6.1

Hotel concierge discovery

HotelConcierge defines ServiceKey[VIPGuest.Command]("concierge-key") and subscribes to it. When VIP guests enter, they register themselves; the concierge receives the listing and logs each guest. A test verifies that the concierge reports both the existing and newly registered guests.

A ServiceKey can also define the membership of an Akka group router. Independently instantiated routees register under the key, while the router discovers them and distributes messages; no routees means messages cannot yet reach a processor. section 6.3.3

How Akka in Action, Second Edition covers it

How deep it goes
Defines typed-key identity and demonstrates registration, subscription, adapters, lookup, deregistration, and routing, without deeper receptionist internals.
Examples
Uses hotel VIP guests and concierges, plus cameras distributing photo URLs among registered photo processors.
What you can do after
Build actor discovery and receptionist-backed routing with typed ServiceKey registration, subscriptions, lookups, and deregistration.
How it connects
Connects ServiceKey with the receptionist, actor registration, message adapters, group routers, and round-robin routing.

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.