Check the size of a List/Map from Apache camel route

We can check the size of a java.util.List using below code. .choice() .when(simple(“${body.size() > 10}”)) .log(LoggingLevel.INFO, “List size is greater than 10”) .when(simple(“${body.size() > 0}”)) .log(LoggingLevel.INFO, “List size is greater than 0”) .otherwise() .log(LoggingLevel.INFO, “List is empty”) .endChoice() Same logic can be used for other collection objects in Java. Please not that you have to add Read More…

Null check in camel routes

In camel routes, null check of body content can be done as given below: .choice() .when(body().isNull()) .log(LoggingLevel.INFO, “Body is null”) .otherwise() .log(LoggingLevel.INFO, “Body is not null”) .endChoice() If you are doing null check on a exchange header, this can be done using: .choice() .when(header(“sampleheader”).isNull()) .log(LoggingLevel.INFO, “Value of exchange header ‘sampleheader’ is null”) .otherwise() .log(LoggingLevel.INFO, “Value Read More…