I would assume your user action will happen in magento. Based on that one of the flows could be:
user does something in magento
magento sends request to start process or finish task with some specific data
your process maps data from magento to variables
process handles logic (i.e. sending email)
In that case logic to send email is directly implemented in java. You could also delegate that using external task, if you have a rest service which can handle it for instance.