def route(event_name, aggregate_id, **data)
      @routes[event_name].each do |listener|
        listener = listener.new if listener.is_a?(Class)
        begin
          listener.public_send(:"on_#{event_name}", aggregate_id, **data)
        rescue RuntimeError => e
          log "Error handling event #{event_name.inspect}: #{e}"
        end
      end
    end
def route(event_name, aggregate_id, **data)
      @routes[event_name].each do |listener|
        listener = listener.new if listener.is_a?(Class)
        begin
          listener.public_send(:"on_#{event_name}", aggregate_id, **data)
        rescue RuntimeError => e
          log "Error handling event #{event_name.inspect}: #{e}"
        end
      end
    end
Routes an event.