My intention is to send a list of messages one by one (messages are generate using values from db). What I do is query and get the message list attach it to the exchange and use split to slipt the messages and it sends
Below is my route
.process(this::analyseSettlement)
.choice()
.when()
.simple("${header.error_reason} == 001")
.log("Settlement Completed")
.otherwise()
.log("BatchUpload process")
.split(body(), flexible().accumulateInCollection(ArrayList.class))
.setHeader(Exchange.HTTP_METHOD).constant(HttpMethod.POST)
.removeHeader(Exchange.HTTP_PATH)
.marshal().json(JsonLibrary.Jackson)
.to("http://localhost:8087/channel/tcp?bridgeEndpoint=true")
// analyze response if success then update the table
// if not return error
.unmarshal(new JacksonDataFormat(InternalTransactionBean.class))
.process(this::analyseBatchUploadResponse)
.end()
.log("${body}")
.process(this::processPostSettlement)
What I require is if I find an error in one of the response need to stop sending all un send messages and end the split and go to postProcesssettlement function
flow required->
Message list->
send message 1 by one
error occurred while processing one message
stop processing the rest of the messages and exit the route
How to achieve this or If my process of sending batch of messages is not correct please advice me regarding that.