Is there any way to install a ‘hook’ in a process that will do something every time a message arrives in the actor? For example, could I make the process to print out “Message arrived! It is currently at position X in the mailbox” every time a message arrives. I’m relatively new to Elixir and until now I’ve not yet found info on how this could be done.
To be clear, I do not want to do something when the message is actually being handled (by receive). I want to do something when it first arrives in the Process and is put in the mailbox.