/** * Publish finish events for each of the specified query labels * * <pre> * {@code * LabelledEvents.start("get", 1l, bus, "typeA", "custom"); try { return "ok"; } finally { RequestEvents.finish("get", 1l, bus, "typeA", "custom"); } * * } * </pre> * * * @param query Completed query * @param correlationId Identifier * @param bus EventBus to post events to * @param labels Query types to post to event bus */ public static <T> void finish(T query, long correlationId, EventBus bus, String... labels) { for (String type : labels) { RemoveLabelledQuery<T> next = finish(query, correlationId, type); bus.post(next); } } /**
@Test public void createRemoveLabelledQuery() { RemoveLabelledQuery<String> userQuery = LabelledEvents.finish(query, corrId, label); RequestData<String> rd = userQuery.getData(); assertThat(rd.getQuery(), is(query)); assertThat(rd.getType(), is(label)); assertThat(rd.getCorrelationId(), is(corrId)); } }
/** * Publish finish events for each of the specified query labels * * <pre> * {@code * LabelledEvents.start("get", 1l, bus, "typeA", "custom"); try { return "ok"; } finally { RequestEvents.finish("get", 1l, bus, "typeA", "custom"); } * * } * </pre> * * * @param query Completed query * @param correlationId Identifier * @param bus EventBus to post events to * @param labels Query types to post to event bus */ public static <T> void finish(T query, long correlationId, EventBus bus, String... labels) { for (String type : labels) { RemoveLabelledQuery<T> next = finish(query, correlationId, type); bus.post(next); } } /**