Hi You can also look at using onCompletion https://camel.apache.org/manual/oncompletion.html
On Sat, Nov 18, 2023 at 8:36 PM Claus Ibsen <claus.ib...@gmail.com> wrote: > Hi > > I would also add that HTTP servers like Tomcat, Jetty, JBoss etc have an > access log that logs how long time each request takes. And they often have > a API / plugin you can use to have your custom code triggered by the HTTP > server > so you can do any kind of "how long time it takes" you need. > > > On Sat, Nov 18, 2023 at 8:34 PM Claus Ibsen <claus.ib...@gmail.com> wrote: > >> Hi >> >> Camel will send back the response at the end of the route in the >> consumer, so what you do in that route example will not work. >> However if you want to do some kind of custom logging of how long it >> takes, then Camel Jetty has send back the response to the client, when the >> UnitOfWork is done. >> So you can use Camel's UoW done to do any custom code for "backend >> response timestamp ...". >> >> See the docs for UnitOfWork or its also covered in the CiA2 book. >> >> >> >> On Tue, Nov 14, 2023 at 5:11 AM Han Yainsun <yain...@hotmail.com> wrote: >> >>> Dear Camel Community and Camel users, >>> >>> Greetings to you! >>> >>> Camel version: 3.20.4 >>> Spring Boot version: 2.7.11 >>> JDK: Amazon Corretto 17 >>> Platform: Windows server 2019 >>> IDE: IntelliJ IDEA 2021.3.2 (Community Edition) >>> >>> I have an requirement that need calculate each message process time, >>> incould total process time and backend process time. the route likes below, >>> it seems that the jetty managed the http session and send the response >>> back to client automatically at the end of route. >>> >>> Is it possible to explicitly inform jetty send the resonse at specific >>> point? >>> >>> Thansk in advance. >>> >>> from("jetty:http://0.0.0.0:8080/test") >>> .process(exchange -> exchange.setProperty("inbound timestamp", >>> System.currentTimeMillis())) >>> .to("http://localhost/mockbackend") >>> .process(exchange -> exchange.setProperty("backend respond timestamp", >>> System.currentTimeMillis())) >>> .setBody(constant("hello")) >>> // I expect jetty send response back to client here. >>> .process(exchange -> exchange.setProperty("backend respond timestamp", >>> System.currentTimeMillis())); >>> >>> >> >> -- >> Claus Ibsen >> ----------------- >> @davsclaus >> Camel in Action 2: https://www.manning.com/ibsen2 >> > > > -- > Claus Ibsen > ----------------- > @davsclaus > Camel in Action 2: https://www.manning.com/ibsen2 > -- Claus Ibsen ----------------- @davsclaus Camel in Action 2: https://www.manning.com/ibsen2