1 Reply Latest reply on Oct 1, 2016 9:50 PM by Fatkhur Rokhman

    Camel's Content Based Routing, how to do substring on body using simple language?

    Fatkhur Rokhman Newbie

      Hi All,


      I'm new to camel based application development.

      how can i do substring on body using sample language in camel routing?

      Let say I have message in activemq queue, named queue.data.raw.

      here is sample message i want to process,


      XXX|20160129|194720|00000013|4|SX  |SAMPLE CAPITAL                                         |0|Ëœ


      I want to get character at 29th (zero based index), it is 4 that represents record type.





                      .when().simple("${body.substring(29,1)} == '2'")     //error


                          .log("Added to 'Trade queue'")

                     .when().simple("${body.substring(29,1)} == 'B'")     //error


                          .log("Added to 'Market Depth queue'")


                           .log("not processed'")



                .log("Processing of ${body} done.");