use of com.netflix.conductor.common.metadata.events.EventExecution in project conductor by Netflix.
the class TestElasticSearchRestDAOV6 method createEventExecution.
private EventExecution createEventExecution(String event) {
EventExecution execution = new EventExecution(uuid(), uuid());
execution.setName("name");
execution.setEvent(event);
execution.setCreated(System.currentTimeMillis());
execution.setStatus(EventExecution.Status.COMPLETED);
execution.setAction(EventHandler.Action.Type.start_workflow);
execution.setOutput(ImmutableMap.of("a", 1, "b", 2, "c", 3));
return execution;
}
use of com.netflix.conductor.common.metadata.events.EventExecution in project conductor by Netflix.
the class TestElasticSearchRestDAOV6 method shouldAsyncAddEventExecution.
@Test
public void shouldAsyncAddEventExecution() throws Exception {
String event = "event2";
EventExecution execution1 = createEventExecution(event);
EventExecution execution2 = createEventExecution(event);
indexDAO.asyncAddEventExecution(execution1).get();
indexDAO.asyncAddEventExecution(execution2).get();
List<EventExecution> indexedExecutions = tryFindResults(() -> indexDAO.getEventExecutions(event), 2);
assertEquals(2, indexedExecutions.size());
assertTrue("Not all event executions was indexed", indexedExecutions.containsAll(Arrays.asList(execution1, execution2)));
}
use of com.netflix.conductor.common.metadata.events.EventExecution in project conductor by Netflix.
the class ElasticSearchRestDAOV7 method mapEventExecutionsResponse.
private List<EventExecution> mapEventExecutionsResponse(SearchResponse response) throws IOException {
SearchHit[] hits = response.getHits().getHits();
List<EventExecution> executions = new ArrayList<>(hits.length);
for (SearchHit hit : hits) {
String source = hit.getSourceAsString();
EventExecution tel = objectMapper.readValue(source, EventExecution.class);
executions.add(tel);
}
return executions;
}
use of com.netflix.conductor.common.metadata.events.EventExecution in project conductor by Netflix.
the class TestElasticSearchRestDAOV7 method createEventExecution.
private EventExecution createEventExecution(String event) {
EventExecution execution = new EventExecution(uuid(), uuid());
execution.setName("name");
execution.setEvent(event);
execution.setCreated(System.currentTimeMillis());
execution.setStatus(EventExecution.Status.COMPLETED);
execution.setAction(EventHandler.Action.Type.start_workflow);
execution.setOutput(ImmutableMap.of("a", 1, "b", 2, "c", 3));
return execution;
}
use of com.netflix.conductor.common.metadata.events.EventExecution in project conductor by Netflix.
the class RedisExecutionDAO method getEventExecutions.
public List<EventExecution> getEventExecutions(String eventHandlerName, String eventName, String messageId, int max) {
try {
String key = nsKey(EVENT_EXECUTION, eventHandlerName, eventName, messageId);
logger.info("getting event execution {}", key);
List<EventExecution> executions = new LinkedList<>();
for (int i = 0; i < max; i++) {
String field = messageId + "_" + i;
String value = dynoClient.hget(key, field);
if (value == null) {
break;
}
recordRedisDaoEventRequests("getEventExecution", eventHandlerName);
recordRedisDaoPayloadSize("getEventExecution", value.length(), eventHandlerName, "n/a");
EventExecution eventExecution = objectMapper.readValue(value, EventExecution.class);
executions.add(eventExecution);
}
return executions;
} catch (Exception e) {
throw new ApplicationException(Code.BACKEND_ERROR, "Unable to get event executions for " + eventHandlerName, e);
}
}
Aggregations