DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
  1. DZone
  2. Coding
  3. Java
  4. Getting an Overview of Actors in an Akka System

Getting an Overview of Actors in an Akka System

Jos Dirksen user avatar by
Jos Dirksen
·
Feb. 04, 15 · Interview
Like (2)
Save
Tweet
Share
3.73K Views

Join the DZone community and get the full member experience.

Join For Free

i've been playing around with akka-http and akka-streams lately and was wondering which kinds of actors were created when i create flow graphs and process http requests. i ran into the typesafe console, but that is already end of live ( https://groups.google.com/forum/#!forum/typesafe-console ) and doesn't support the newer versions of akka.

so after some looking around i ran into a post on stackoverflow providing an alternative approach ( http://stackoverflow.com/questions/25860939/how-print-all-actors-in-akka... ):

listactors.png

this posts lists some pseudo code, which pointed me in pretty much the right direction. i currently use the following actor to print out all the actors in the system:

class idactor extends actor with actorlogging {
 
 def receive = {
    case "start" =>
      log.info("current actors in system:")
      self ! actorpath.fromstring("akka://streams/user/")
 
    case path: actorpath =>
      context.actorselection(path / "*") ! identify(())
 
    case actoridentity(_, some(ref)) =>
      log.info(ref.tostring())
      self ! ref.path
  }
}

to start this all we have to do is get the actor and message "start":

val idactor = system.actorof(props[idactor],"idactor"); idactor ! "start"

the result is very interesting. for instance in a http-akka system with a couple of flows running i get the following overview of actors:

current actors in system:
actor[akka://streams/user/$a/flow-1-2-1-foreach-stagefactory#-1147809628]
actor[akka://streams/user/$a/flow-1-2-1-foreach-stagefactory#-1147809628]
actor[akka://streams/user/$a/flow-1-2-1-foreach-stagefactory#-1147809628]
actor[akka://streams/user/$a/flow-1-2-1-foreach-stagefactory#-1147809628]
actor[akka://streams/user/$a/flow-1-2-1-foreach-stagefactory#-1147809628]
actor[akka://streams/user/$a#-992619289]
actor[akka://streams/user/idactor#830993582]
actor[akka://streams/user/$a/flow-1-1-map#310662784]
...
actor[akka://streams/user/$a/flow-751-1-prefixandtail#801612770]
actor[akka://streams/user/$a/flow-752-1-prefixandtail#-1939947471]
actor[akka://streams/user/$a/flow-753-1-prefixandtail#102076528]
actor[akka://streams/user/$a/flow-754-1-prefixandtail#-1858318406]
actor[akka://streams/user/$a/flow-755-1-prefixandtail#595550267]
actor[akka://streams/user/$a/flow-756-1-prefixandtail#-1675014490]
actor[akka://streams/user/$a/flow-76-1-map#-1734873421]
actor[akka://streams/user/$a/flow-93-1-map#174954170]
actor[akka://streams/user/$a/flow-726-1-mapasync#2041440238]
actor[akka://streams/user/$a/flow-725-1-mapasync#-674218071]
actor[akka://streams/user/$a/flow-745-1-mapasync#-800760294]

cool right. not that you can do much with it, but it at least gives you a good overview of what is happening internally.

Akka (toolkit)

Published at DZone with permission of Jos Dirksen, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • A Complete Guide to AngularJS Testing
  • Spring Cloud: How To Deal With Microservice Configuration (Part 1)
  • How to Develop a Portrait Retouching Function
  • Unlocking the Power of Polymorphism in JavaScript: A Deep Dive

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: