Flux.concatMap going to next event before returning the result

438 Views Asked by At

I have a Flux of test case objects, for each object, I need to call an external service, once a service response is received, in the next operation, it checks if the response is valid or not. But randomly for a few objects, before the response is received from the external service, Flux is releasing the signal.

Flux.fromIterable(masterTestCasesList).concatMap(tc -> iSandBoxRuleEngineClient.getRoutePlanResponseForTestCase(tc))
        .map(respObj -> {//checks if the response is matched.
            return result;}).collectList();
                                    
                                    

Expected Result : 1)Ref Id: 10002 TestCase : TESTCASE_1. 2)Before calling the service for Ref Id: 10002 TestCase : TESTCASE_1. 3)After hit : Resp generated; Ref id: 10002 TestCase : TESTCASE_1. 4)Ref Id: 10002 TestCase : TESTCASE_1 Is matched true.

1)Ref Id: 10002 TestCase : TESTCASE_2. 2)Before calling the service for Ref Id: 10002 TestCase : TESTCASE_2. 3)After hit : Resp generated; Ref id: 10002 TestCase : TESTCASE_2. 4)Ref Id: 10002 TestCase : TESTCASE_2 Is matched true.

1)Ref Id: 10002 TestCase : TESTCASE_3. 2)Before calling the service for Ref Id: 10002 TestCase : TESTCASE_3. 3)After hit : Resp generated; Ref id: 10002 TestCase : TESTCASE_3. 4)Ref Id: 10002 TestCase : TESTCASE_3 Is matched true.

Generated Output:

1)Ref Id: 10002 TestCase : TESTCASE_1. 2)Before calling the service for Ref Id: 10002 TestCase : TESTCASE_1. 3)After hit : Resp generated; Ref id: 10002 TestCase : TESTCASE_1. 4)Ref Id: 10002 TestCase : TESTCASE_1 Is matched true.

1)Ref Id: 10002 TestCase : TESTCASE_2. 2)Before calling the service for Ref Id: 10002 TestCase : TESTCASE_2.

1)Ref Id: 10002 TestCase : TESTCASE_3. 2)Before calling the service for Ref Id: 10002 TestCase : TESTCASE_3. 3)After hit : Resp generated; Ref id: 10002 TestCase : TESTCASE_3. 4)Ref Id: 10002 TestCase : TESTCASE_3 Is matched true.

0

There are 0 best solutions below