I have a legacy code that I’m refactoring into executing asynchronously. The easiest would be to start a Task from DynamicSupervisor. But I don’t know how to handle task termination/completion.
- Don’t need to restart failed tasks, so :temporary mode for supervisor suits me.
- For normal completion of the task, need to send a message via PubSub
- For abnormal termination of the task, need to send a message via PubSub and possibly do some cleanup.
I suppose for normal death I can trigger PubSub in the function that calls legacy process and is passed into Task. But abnormal must be caught somehow…
Is DynamicSupervisor suitable for that? How do I catch task’s :DOWN message for whatever reason - normal or abnormal termination?






















