The simplest way to fire an action when a node is reached is to code the Node as Service Task.
Each ServiceTask includes On-entry and on-exit actions which are executed upon entry or exit of this node, respectively.
A common use for an On-entry action is to set variables when we enter the node
If you need more complex actions on node entry, it is recommended to code a Custom Task, which is an empty, generic, unit of work. You need to provide a WorkItemHandler implementation for the task and register it with WorkItemManager.
Check the following tutorial to learn mode about Custom Tasks: How to create a custom WorkItem Handler in jBPM