Search in sources :

Example 1 with CommandType

use of com.walmartlabs.concord.server.CommandType in project concord by walmartlabs.

the class Dispatcher method sendResponse.

private void sendResponse(Match match, AgentCommand response) {
    WebSocketChannel channel = match.request.channel;
    long correlationId = match.request.request.getCorrelationId();
    CommandType type = CommandType.valueOf((String) response.getData().remove(Commands.TYPE_KEY));
    Map<String, Object> payload = new HashMap<>();
    payload.put("type", type.toString());
    payload.putAll(response.getData());
    boolean success = channelManager.sendResponse(channel.getChannelId(), CommandResponse.cancel(correlationId, payload));
    if (success) {
        log.info("sendResponse ['{}'] -> done", correlationId);
    } else {
        log.error("sendResponse ['{}'] -> failed", correlationId);
    }
}
Also used : CommandType(com.walmartlabs.concord.server.CommandType) WebSocketChannel(com.walmartlabs.concord.server.websocket.WebSocketChannel)

Aggregations

CommandType (com.walmartlabs.concord.server.CommandType)1 WebSocketChannel (com.walmartlabs.concord.server.websocket.WebSocketChannel)1