use of org.openkilda.messaging.error.ErrorType in project open-kilda by telstra.
the class CrudBolt method handleErrorRequest.
private void handleErrorRequest(String flowId, ErrorMessage message, Tuple tuple) throws IOException {
ErrorType errorType = message.getData().getErrorType();
message.getData().setErrorDescription("topology-engine internal error");
logger.info("Flow {} {} failure", errorType, flowId);
switch(errorType) {
case CREATION_FAILURE:
flowCache.removeFlow(flowId);
break;
case UPDATE_FAILURE:
handleStateRequest(flowId, FlowState.DOWN, tuple);
break;
case DELETION_FAILURE:
break;
case INTERNAL_ERROR:
break;
default:
logger.warn("Flow {} undefined failure", flowId);
}
Values error = new Values(message, errorType);
outputCollector.emit(StreamType.ERROR.toString(), tuple, error);
}
use of org.openkilda.messaging.error.ErrorType in project open-kilda by telstra.
the class ErrorBolt method execute.
/**
* {@inheritDoc}
*/
@Override
public void execute(Tuple tuple) {
ComponentType componentId = ComponentType.valueOf(tuple.getSourceComponent());
StreamType streamId = StreamType.valueOf(tuple.getSourceStreamId());
ErrorType errorType = (ErrorType) tuple.getValueByField(FlowTopology.ERROR_TYPE_FIELD);
ErrorMessage error = (ErrorMessage) tuple.getValueByField(AbstractTopology.MESSAGE_FIELD);
error.setDestination(Destination.NORTHBOUND);
Values values = new Values(error);
try {
logger.debug("Request tuple={}", tuple);
switch(componentId) {
case CRUD_BOLT:
case SPLITTER_BOLT:
logger.debug("Error message: data={}", error.getData());
outputCollector.emit(StreamType.RESPONSE.toString(), tuple, values);
break;
default:
logger.debug("Skip message from unknown component: component={}, stream={}, error-type={}", componentId, streamId, errorType);
break;
}
} catch (Exception exception) {
logger.error("Could not process message: {}", tuple, exception);
} finally {
logger.debug("Error message ack: component={}, stream={}, tuple={}, values={}", tuple.getSourceComponent(), tuple.getSourceStreamId(), tuple, values);
outputCollector.ack(tuple);
}
}
Aggregations