Source:
<code>private void handleEvent(final HttpServletRequest req, final HttpServletResponse resp) throws IOException { final Timer.Context classTimer = METRICLASSTIMER.time(); final UUID kasperCorrelationUUID = UUID.randomUUID(); resp.addHeader("kasperCorrelationId", kasperCorrelationUUID.toString()); REQUEST_LOGGER.info("Processing HTTP Event '{}' '{}'", req.getMethod(), getFullRequestURI(req)); final String eventName = resourceName(req.getRequestURI()); final Class<? extends Event> eventClass = exposedEvents.get(eventName); if (null == eventClass) { resp.setStatus(Response.Status.NOT_FOUND.getStatusCode()); return; } JsonParser parser = null; try { if (!req.getContentType().contains(MediaType.APPLICATION_JSON_VALUE)) { resp.setStatus(Response.Status.UNSUPPORTED_MEDIA_TYPE.getStatusCode()); return; } final ObjectReader reader = mapper.reader(); parser = reader.getFactory().createJsonParser(req.getInputStream()); final Event event = reader.readValue(parser, eventClass); final Context context = contextDeserializer.deserialize(req, kasperCorrelationUUID); MDC.setContextMap(context.asMap()); final Timer.Context eventHandleTime = METRICS.timer(name(event.getClass(), "requests-handle-time")).time(); final Timer.Context classHandleTime = METRICLASSHANDLETIMER.time(); <START> eventBus.publish(event); <END> resp.setStatus(Response.Status.ACCEPTED.getStatusCode()); eventHandleTime.stop(); classHandleTime.stop(); } catch (final IOException e) { LOGGER.error("Error in event [" + eventClass.getName() + "]", e); resp.setStatus(Response.Status.BAD_REQUEST.getStatusCode()); } catch (final Throwable th) { LOGGER.error("Error in event [" + eventClass.getName() + "]", th); resp.setStatus(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()); } finally { if (null != parser) { parser.close(); } final long time = classTimer.stop(); REQUEST_LOGGER.info("Execution Time '{}' ns", time); METRICLASSREQUESTS.mark(); } }</code><technical_language>a fire forget? I opt for this solution. blame client event of error in a queryhandler. notifing listeners of something, care if listeners problems. agree</technical_language>

Target:
private void handleEvent(final HttpServletRequest req, final HttpServletResponse resp) throws IOException { final Timer.Context classTimer = METRICLASSTIMER.time(); final UUID kasperCorrelationUUID = UUID.randomUUID(); resp.addHeader("kasperCorrelationId", kasperCorrelationUUID.toString()); REQUEST_LOGGER.info("Processing HTTP Event '{}' '{}'", req.getMethod(), getFullRequestURI(req)); final String eventName = resourceName(req.getRequestURI()); final Class<? extends Event> eventClass = exposedEvents.get(eventName); if (null == eventClass) { resp.setStatus(Response.Status.NOT_FOUND.getStatusCode()); return; } JsonParser parser = null; try { if ( ! req.getContentType().contains(MediaType.APPLICATION_JSON_VALUE)) { resp.setStatus(Response.Status.UNSUPPORTED_MEDIA_TYPE.getStatusCode()); return; } final ObjectReader reader = mapper.reader(); parser = reader.getFactory().createJsonParser(req.getInputStream()); final Event event = reader.readValue(parser, eventClass); final Context context = contextDeserializer.deserialize(req, kasperCorrelationUUID); MDC.setContextMap(context.asMap()); final Timer.Context eventHandleTime = METRICS.timer(name(event.getClass(), "requests-handle-time")).time(); final Timer.Context classHandleTime = METRICLASSHANDLETIMER.time(); eventBus.publish(event); resp.setStatus(Response.Status.ACCEPTED.getStatusCode()); eventHandleTime.stop(); classHandleTime.stop(); } catch (final IOException e) { LOGGER.error("Error in event [" + eventClass.getName() + "]", e); METRICLASSERRORS.mark(); resp.setStatus(Response.Status.BAD_REQUEST.getStatusCode()); } catch (final Throwable th) { LOGGER.error("Error in event [" + eventClass.getName() + "]", th); METRICLASSERRORS.mark(); resp.setStatus(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()); } finally { if (null != parser) { parser.close(); } final long time = classTimer.stop(); REQUEST_LOGGER.info("Execution Time '{}' ns", time); METRICLASSREQUESTS.mark(); } }