I have a .choice() statement with multiple .when() cases. However I upload the same file everytime that has MsgFmtVerNr=2 and sometimes it goes to otherwise and sometimes it goes through .when().xpath("/UpsBas/MsgHdr/MsgFmtVerNr = '2'"). I have no idea why this statement is only working half of the time. Is there some reason why it would skip directly to .otherwise() statement? Thanks for the help in advanced.
.choice()
.when(body().startsWith(constant("A")))
.setHeader(MsgHdr.EVENT_CODE, simple(ErrorCodesLocal.UNSOLICITEDMSG_GIC_BSIS))
.beanRef("fromGICRoute", "setMessageHeadersForUnsolicitedMessage(*)")
.beanRef("logging", "debug(*, 'Messsage from " + FromGicSourceQueue + " is a unsolicited message')")
.multicast().parallelProcessing()
.to("direct:unsolicitedMessageToBoss", "direct:unsolicitedMessageToCmods", "direct:unsolicitedMessageToIsps")
.endChoice()
.when(body().contains("<RtgPfl"))
.to(RATING_PROFILE_DESTINATION_QUEUE)
.when().xpath("/UpsBas/MsgHdr/MsgFmtVerNr = '2'")//body().contains("<MsgFmtVerNr>2<"))
.to("direct:cv2")
.otherwise()
.to("direct:commercialInvoice")