/** * Marks the start of a query identified by the provided correlationId, with additional query type and data parameters * * @param query - Query data * @param correlationId - Identifier * @param type - allows queries to be grouped by type * @return Start event to pass to the Events systems EventBus */ public static <T> AddQuery<T> start(T query, long correlationId, String type) { return start(query, correlationId, type, null); }
/** * Marks the end of a query identified by the provided correlationId * * @param query - Query data * @param correlationId - Identifier * @return Finish event to pass to the Events systems EventBus */ public static <T> RemoveQuery<T> finish(T query, long correlationId) { return finish(query, correlationId, "default"); }
/** * Marks the start of a query identified by the provided correlationId, with additional query type and data parameters * * @param query - Query data * @param correlationId - Identifier * @param label - allows queries to be grouped by label * @return Start event to pass to the Events systems EventBus */ public static <T> AddLabelledQuery<T> start(T query, long correlationId, String label) { return start(query, correlationId, label, null); }
/** * Marks the start of a query identified by the provided correlationId, with additional query type and data parameters * * @param query - Query data * @param correlationId - Identifier * @param label - allows queries to be grouped by label * @param additionalData - Any additional info about the request to be rendered in the JSON view / rest endpoint * @return Start event to pass to the Events systems EventBus */ public static <T> AddLabelledQuery<T> start(T query, long correlationId, String label, Object additionalData) { return new AddLabelledQuery( RequestData.builder() .query(query) .correlationId(correlationId) .type(label) .additionalData(additionalData) .build()); }
/** * Marks the end of a query identified by the provided correlationId * * @param query - Query data * @param correlationId - Identifier * @param type - allows queries to be grouped by type * @return */ public static <T> RemoveQuery<T> finish(T query, long correlationId, String type) { return new RemoveQuery<>( RequestData.builder() .query(query) .correlationId(correlationId) .type(type) .build()); }
/** * Marks the end of a query identified by the provided correlationId * * @param query - Query data * @param correlationId - Identifier * @param label - allows queries to be grouped by type * @return RemoveLabelledQuery event to pass to the Events systems EventBus */ public static <T> RemoveLabelledQuery<T> finish(T query, long correlationId, String label) { return new RemoveLabelledQuery<>( RequestData.builder() .query(query) .correlationId(correlationId) .type(label) .build()); } }
@Subscribe public void finished(RemoveQuery<T> data) { String key = data.getData().type; map.computeIfAbsent(key, k -> new RequestsBeingExecuted<T>( bus, k)).events.finished(buildId(data.getData())); }
@Bean public RequestTypes microEventRequestTypes() { RequestsBeingExecuted def = this.microEventRequestsBeingExecuted(); RequestTypes types = new RequestTypes( bus, requestCapture); types.getMap() .put(def.getType(), def); return types; }
private void postEvent(ProceedingJoinPoint pjp, String type, JobExecutingData data, SystemData retVal) { if (retVal != null) { eventBus.post(retVal); } events.finished(buildId(type, data.getProcessingThread())); }
@Override public String toString() { return events.toString(); }
Map toMap() { return events.toMap(); } }
/** * Marks the start of a query identified by the provided correlationId * * @param query - Query data * @param correlationId - Identifier * @return Start event to pass to the Events systems EventBus */ public static <T> AddQuery<T> start(T query, long correlationId) { return start(query, correlationId, "default", null); }
@Override public String toString() { return events.toString(); }