Astarno
Run code upon messages (first) arriving in a Process
Hey there,
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.
Thanks! ![]()
Most Liked
benwilson512
I do not believe that this is possible, the only way that I know of to interact with a mailbox is to receive from it, and that is of course only doable within the process associated with the mailbox.
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance









