As a long time Java EE dev, I've used the MDC (Mapped Diagnostic Context) approach to deal with passing around contextual data relating to a request, e.g. a unique request token for tracking a request across many potential log events that occur during the lifetime of that request.
Given it's reliance on ThreadLocal, it's pretty clear that this approach implodes when using asynchronous techniques.
I'm still in the early days of learning Scala and, more relevant to this question, Akka. I have read plenty of forum postings confirming the incompatibility of Akka and MDC but have not yet uncovered a consistent strategy for mimicking the MDC approach in some way.
Is it simply best to just explicitly pass this sort of data around as part of the messages that get sent between actors? It kind of feels dirty but, at the same time, compatible with the ability to scale effortlessly.
Is there any other way to pass context to an Actor other than directly via messages? Also, has anyone faced this same challenge when using Play 2.0 Async blocks?