I have a .split  method component that returns a list of classes from the body if the class meets a requirement.  It is possible that the method will return and zero size list.  In this case the CamelSplitSize is not set and does not return a zero.  is there a way to catch this. If the route processes data it returns a Map<String,Object> in the body to the calling route if it fails it returns the class it was sent in the body. Ideally sending back a empty  Map<String,Object> would be preferred with a CamelSplitSize of 0;

    .split(method("eligibilityUnitSplitter", "splitClientIndexMembers"), new AggregateMemberCaseAndStatus())


splitter method

        public List<EligibilityMember> splitClientIndexMembers(Exchange exchange){             Map<Object,EligibilityMember> eligibilityMembers = (Map<Object, EligibilityMember>) exchange.getIn().getBody(EligibilityUnit.class).getEligibilityMembers();             List<EligibilityMember> members = new ArrayList<EligibilityMember>();

            for (Entry<Object, EligibilityMember> eligibilityMember : eligibilityMembers.entrySet()) {
if(Objects.nonNull(eligibilityMember.getValue().getMemberIdentifiers().get("ClientIndex"))
                        &&  Objects.nonNull( eligibilityMember.getValue().getMemberIdentifiers().get("ClientIndex"))                         &&  !((String) eligibilityMember.getValue().getMemberIdentifiers().get("ClientIndex")).trim().equalsIgnoreCase("") ) {
                        members.add(eligibilityMember.getValue());
                     }
            }
            return members;

        }



Reply via email to