Add setup function for the event module

(cherry picked from the commit 2c0b9027de841a437baf7b9c85262f196b9cb09e)