use of com.walmartlabs.concord.server.queueclient.message.ProcessResponse in project concord by walmartlabs.
the class Dispatcher method sendResponse.
private void sendResponse(Match match) {
WebSocketChannel channel = match.request.channel;
long correlationId = match.request.request.getCorrelationId();
ProcessQueueEntry item = match.response;
try {
SecretReference secret = null;
if (item.repoId() != null) {
secret = dao.getSecretReference(item.repoId());
}
// backward compatibility with old process queue entries that are not normalized
Imports imports = importsNormalizerFactory.forProject(item.projectId()).normalize(item.imports());
ProcessResponse resp = new ProcessResponse(correlationId, sessionTokenCreator.create(item.key()), item.key().getInstanceId(), secret != null ? secret.orgName : null, item.repoUrl(), item.repoPath(), item.commitId(), item.commitBranch(), secret != null ? secret.secretName : null, imports);
if (!channelManager.sendResponse(channel.getChannelId(), resp)) {
log.warn("sendResponse ['{}'] -> failed", correlationId);
}
logManager.info(item.key(), "Acquired by: " + channel.getUserAgent());
} catch (Exception e) {
log.error("sendResponse ['{}'] -> failed (instanceId: {})", correlationId, item.key().getInstanceId());
}
}
use of com.walmartlabs.concord.server.queueclient.message.ProcessResponse in project concord by walmartlabs.
the class Agent method take.
private JobRequest take(QueueClient queueClient) throws Exception {
Future<ProcessResponse> req = queueClient.request(new ProcessRequest(agentCfg.getCapabilities()));
ProcessResponse resp = req.get();
if (resp == null) {
return null;
}
Path workDir = IOUtils.createTempDir(agentCfg.getPayloadDir(), "workDir");
return JobRequest.from(resp, workDir);
}
Aggregations