src-java/flowhs-topology/flowhs-storm-topology/src/main/java/org/openkilda/wfm/topology/flowhs/service/FlowCreateService.java
/**
     * Handles request for flow creation.
     *
     * @param key     command identifier.
     * @param request request data.
     */
Handles request for flow creation.
@param key     command identifier.
@param request request data.
Handles request for flow creation . @param key command identifier . @param request request data .
public void handleRequest(String key, CommandContext commandContext, FlowRequest request) {
        log.debug("Handling flow create request with key {} and flow ID: {}", key, request.getFlowId());
        if (fsms.containsKey(key)) {
            log.error("Attempt to create a FSM with key {}, while there's another active FSM with the same key.", key);
            return;
        }
        String eventKey = commandContext.getCorrelationId();
        if (flowEventRepository.existsByTaskId(eventKey)) {
            log.error("Attempt to reuse key {}, but there's a history record(s) for it.", eventKey);
            return;
        }
        FlowCreateFsm fsm = fsmFactory.produce(request.getFlowId(), commandContext);
        fsms.put(key, fsm);
        RequestedFlow requestedFlow = RequestedFlowMapper.INSTANCE.toRequestedFlow(request);
        if (requestedFlow.getFlowEncapsulationType() == null) {
            requestedFlow.setFlowEncapsulationType(
                    kildaConfigurationRepository.getOrDefault().getFlowEncapsulationType());
        }
        if (requestedFlow.getPathComputationStrategy() == null) {
            requestedFlow.setPathComputationStrategy(
                    kildaConfigurationRepository.getOrDefault().getPathComputationStrategy());
        }
        FlowCreateContext context = FlowCreateContext.builder()
                .targetFlow(requestedFlow)
                .build();
        fsm.setTargetFlow(requestedFlow);
        fsm.start();
        processNext(fsm, context);
        removeIfFinished(fsm, key);
    }
public void handleRequest ( String key , CommandContext commandContext , FlowRequest request ) { log . debug ( "Handling flow create request with key {} and flow ID: {}" , key , request . getFlowId ( ) ) ; if ( fsms . containsKey ( key ) ) { log . error ( "Attempt to create a FSM with key {}, while there's another active FSM with the same key." , key ) ; return ; } String eventKey = commandContext . getCorrelationId ( ) ; if ( flowEventRepository . existsByTaskId ( eventKey ) ) { log . error ( "Attempt to reuse key {}, but there's a history record(s) for it." , eventKey ) ; return ; } FlowCreateFsm fsm = fsmFactory . produce ( request . getFlowId ( ) , commandContext ) ; fsms . put ( key , fsm ) ; RequestedFlow requestedFlow = RequestedFlowMapper . INSTANCE . toRequestedFlow ( request ) ; if ( requestedFlow . getFlowEncapsulationType ( ) == null ) { requestedFlow . setFlowEncapsulationType ( kildaConfigurationRepository . getOrDefault ( ) . getFlowEncapsulationType ( ) ) ; } if ( requestedFlow . getPathComputationStrategy ( ) == null ) { requestedFlow . setPathComputationStrategy ( kildaConfigurationRepository . getOrDefault ( ) . getPathComputationStrategy ( ) ) ; } FlowCreateContext context = FlowCreateContext . builder ( ) . targetFlow ( requestedFlow ) . build ( ) ; fsm . setTargetFlow ( requestedFlow ) ; fsm . start ( ) ; processNext ( fsm , context ) ; removeIfFinished ( fsm , key ) ; }
Handles request for flow creation.
Handles request for flow creation .