use of org.openkilda.wfm.topology.flowhs.fsm.swapendpoints.FlowSwapEndpointsContext in project open-kilda by telstra.
the class FlowSwapEndpointsHubService method handleAsyncResponse.
/**
* Handles async response.
*/
public void handleAsyncResponse(String key, Message message) {
log.debug("Received response {}", message);
FlowSwapEndpointsFsm fsm = fsmRegister.getFsmByKey(key).orElse(null);
if (fsm == null) {
log.warn("Failed to find a FSM: received response with key {} for non pending FSM", key);
return;
}
if (message instanceof InfoMessage && ((InfoMessage) message).getData() instanceof FlowResponse) {
fsm.fire(Event.RESPONSE_RECEIVED, new FlowSwapEndpointsContext(((InfoMessage) message).getData()));
} else if (message instanceof ErrorMessage) {
fsm.fire(Event.ERROR_RECEIVED, new FlowSwapEndpointsContext(((ErrorMessage) message).getData()));
} else {
log.warn("Key: {}; Unhandled message {}", key, message);
}
removeIfFinished(fsm, key);
}
Aggregations