use of com.walmartlabs.concord.server.sdk.PartialProcessKey in project concord by walmartlabs.
the class ProcessLocksResource method assertProcess.
private ProcessEntry assertProcess(UUID instanceId) {
PartialProcessKey processKey = PartialProcessKey.from(instanceId);
ProcessEntry p = processQueueManager.get(processKey);
if (p == null) {
throw new ConcordApplicationException("Process not found: " + instanceId, Response.Status.NOT_FOUND);
}
if (p.orgId() == null) {
throw new ConcordApplicationException("Organization is required", Response.Status.BAD_REQUEST);
}
if (p.projectId() == null) {
throw new ConcordApplicationException("Project is required", Response.Status.BAD_REQUEST);
}
return p;
}
use of com.walmartlabs.concord.server.sdk.PartialProcessKey in project concord by walmartlabs.
the class OneOpsEventResource method event.
@POST
@Path("/oneops")
@Consumes(MediaType.APPLICATION_JSON)
@WithTimer
public Response event(Map<String, Object> event) {
if (executor.isDisabled(EVENT_SOURCE)) {
log.warn("event ['{}'] disabled", EVENT_SOURCE);
return Response.ok().build();
}
if (event == null || event.isEmpty()) {
return Response.status(Status.BAD_REQUEST).build();
}
if (cfg.isLogEvents()) {
auditLog.add(AuditObject.EXTERNAL_EVENT, AuditAction.ACCESS).field("source", EVENT_SOURCE).field("eventId", String.valueOf(event.get("cmsId"))).field("payload", event).log();
}
List<OneOpsTriggerProcessor.Result> results = new ArrayList<>();
processors.forEach(p -> p.process(event, results));
for (OneOpsTriggerProcessor.Result result : results) {
Event e = Event.builder().id(String.valueOf(event.get("cmsId"))).name(EVENT_SOURCE).attributes(result.event()).initiator(memo(new EventInitiatorSupplier("author", userManager, result.event()))).build();
List<PartialProcessKey> processKeys = executor.execute(e, initiatorResolver, result.triggers());
log.info("event ['{}'] -> done, {} processes started", e.id(), processKeys.size());
}
return Response.ok().build();
}
Aggregations