Yes, this is possible. Probably the best way is to split the current route in multiple routes (each with its own function). You can even keep the crontab when needed. Something like this:
rest("/api") .post("/transfertrain") .to("direct:transfertrain"); from(Quartz.compose(getClass().getSimpleName(), getGroup(), Quartz.setCron(getScheduling()).asText())) .routeId("crontab") .to("direct:transfertrain") from("direct:transfertrain") .routeId("transfertrain") .setBody(transferTrainKmSupplier) ... You can put the first and last in a normal RouteBuilder and the other in a CrontabRouteBuilder . Note if the routes need to see each other in the JVM you can change the endpoint to direct-vm. And when there are lots of messages, it's probably good to place a broker (for example ActiveMQ) between the routes. Raymond On Wed, Aug 31, 2022 at 3:55 PM Giovanni Di Lembo <g.dilemb...@gmail.com> wrote: > Hi all > I have a CrontabRouteBuilder that I like to transform to a rest service > with camel > Actually I have: > > > from(Quartz.compose(getClass().getSimpleName(), getGroup(), > Quartz.setCron(getScheduling()).asText())) > > // routeId > > .routeId(getRouteId()).group(getGroup()) > > // set list command per train > > .setBody(transferTrainKmSupplier) > > // split > > .split(body()) > > // parallel processing > > > > .parallelProcessing().executorService(Executors.newFixedThreadPool(maxThreads)) > > // set readingDate > > .setHeader("readingDate", simple("$simple{date:now:yyyy-MM-dd}")) > > // set readingTime > > .setHeader("readingTime", simple("$simple{date:now:kk:mm:ss}")) > > // set command > > .setHeader("command", simple("$simple{body[0]}")) > > // set uri > > .setHeader("uri", simple("$simple{body[1]}")) > > // set tag > > .setHeader("tag", simple("$simple{body[2]}")) > > // set num > > .setHeader("num", simple("$simple{body[3]}")) > > // reset command as body > > .setBody(simple("$simple{body[0]}")) > > // log > > .log("$simple{header[host]} $simple{header[tag]} > $simple{header[command]} started.") > > // pass header[uri] to toD, connect > > .toD(simple("$simple{header[uri]}").getText()) > > // choice > > > .choice().when().simple("$simple{body.startsWith(\"ACK-group_state\")}") > > // marshal response > > .unmarshal(new BindyCsvDataFormat(TransferTrainKmRecord.class)) > > // transform > > .bean(TransferTrainKmTransformer.class).to(toLoad()) > > // otherwise > > .otherwise().to(DIRECT_ERROR) > > // end choice > > .end(); > > > > I wonder if it possibile to transform the from as a post rest endpoint > Regards >