public Class<? extends IVersionedApimanEvent> getKlazz(JsonNode payload) {
        JsonNode possibleHeaders = payload.at("/headers");
        if (!possibleHeaders.isMissingNode() && possibleHeaders.isObject()) {
            String type = possibleHeaders.get("type").asText();
            long version = possibleHeaders.get("eventVersion").asLong();
            if (StringUtils.isBlank(type)) {
                throw new IllegalStateException("'type' field missing from headers");
            }
            ClazzAndMetadata result = klazzez.get(type).stream()
                             .filter(k -> k.metadata.version() == version)
                             .findFirst()
                             .orElseThrow(() -> new NoSuchElementException("Can't find an event class for " + payload));
            LOGGER.debug("Found class for event payload: {0}", result);
            return result.klazz;
        }
        throw new IllegalArgumentException("Provided JsonNode structure does not appear to be an ApimanEvent: " + payload);
    }
Turn JsonNode structure into an @ApimanEvent extending IVersionedApimanEvent
manager/api/rest-impl/src/main/java/io/apiman/manager/api/events/EventFactory.java