Skip to content

Add Macro for Handler Registration

Right now, there's a lot of boilerplate required to connect event types to handlers:

def process(:pre, bundle = %Bundle{event: %Event{type: "UserRegistered"}}) do
  {:ok, Map.put(bundle, :handler, UserRegistered)}
end

Adding a macro would allow this to become:

connect("UserRegistered", UserRegistered)
# or 
handler("UserRegistered", UserRegistered)