use of org.openkilda.messaging.nbtopology.request.BaseRequest in project open-kilda by telstra.
the class PersistenceOperationsBolt method handleInput.
protected void handleInput(Tuple input) throws Exception {
BaseRequest request = pullValue(input, FIELD_ID_REQUEST, BaseRequest.class);
log.debug("Received operation request");
try {
List<? extends InfoData> result = processRequest(input, request);
getOutput().emit(input, new Values(result, getCommandContext()));
} catch (MessageException e) {
log.error(format("Failed to process request: %s", e.getMessage()), e);
ErrorData data = new ErrorData(e.getErrorType(), e.getMessage(), e.getErrorDescription());
getOutput().emit(StreamType.ERROR.toString(), input, new Values(data, getCommandContext()));
}
}
use of org.openkilda.messaging.nbtopology.request.BaseRequest in project open-kilda by telstra.
the class RouterBolt method handleInput.
@Override
protected void handleInput(Tuple input) throws PipelineException {
String key = input.getStringByField(MessageKafkaTranslator.FIELD_ID_KEY);
Message message = pullValue(input, FIELD_ID_PAYLOAD, Message.class);
if (message instanceof CommandMessage) {
if (active) {
log.debug("Received command message {}", message);
CommandMessage command = (CommandMessage) message;
CommandData data = command.getData();
if (data instanceof BaseRequest) {
BaseRequest baseRequest = (BaseRequest) data;
processRequest(input, key, baseRequest);
}
}
} else if (message instanceof InfoMessage || message instanceof ErrorMessage) {
log.debug("Received hub response message {}", message);
emitWithContext(SpeakerWorkerBolt.INCOME_STREAM, input, new Values(key, message));
} else {
unhandledInput(input);
}
}
Aggregations