You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "brianmolinaspring (via GitHub)" <gi...@apache.org> on 2023/10/30 15:12:28 UTC

[I] LocalDateTime not work in Apache Camel quarkus [camel-quarkus]

brianmolinaspring opened a new issue, #5474:
URL: https://github.com/apache/camel-quarkus/issues/5474

   ### Bug description
   
   Hello guys, please help, I have my pod made in Quarkus with Apache Camel and native mode, I have an issue with my pod, since it is not updating the record of my logs with the current date, for example I have this in my route :
   
   .log("\n["+getCurrentDateTime()+"]")
   but I see that the date that the log gives me is the exact date on which the pod was created, and it does not change for each request, additionally I leave you this function
   
   private Timestamp getCurrentDateTime() {
   
           LocalDateTime now = LocalDateTime.now();
           return Timestamp.valueOf(now);
       }
   
   I don't know if there are incompatibility issues with camel, I read that I can use this ${date:now:yyyyMMdd}, but my code is already in a testing environment and I want to know if there is any reason to see this strange behavior and if it can be solved.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] LocalDateTime not work in Apache Camel quarkus [camel-quarkus]

Posted by "brianmolinaspring (via GitHub)" <gi...@apache.org>.
brianmolinaspring commented on issue #5474:
URL: https://github.com/apache/camel-quarkus/issues/5474#issuecomment-1786104389

   ok friend, thanks for answering, with this every time I call the log does the log update? What makes it different is the annotation?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] LocalDateTime not work in Apache Camel quarkus [camel-quarkus]

Posted by "ppalaga (via GitHub)" <gi...@apache.org>.
ppalaga commented on issue #5474:
URL: https://github.com/apache/camel-quarkus/issues/5474#issuecomment-1788020053

   Happy to hear that!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] LocalDateTime not work in Apache Camel quarkus [camel-quarkus]

Posted by "ppalaga (via GitHub)" <gi...@apache.org>.
ppalaga commented on issue #5474:
URL: https://github.com/apache/camel-quarkus/issues/5474#issuecomment-1786692909

   > What makes it different is the annotation?
   
   The main difference is that with `.log("${bean:myBean.getCurrentDateTime()}")` you pass an expression that will be evaluated on each call rather than a value obtained at route creation.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] LocalDateTime not work in Apache Camel quarkus [camel-quarkus]

Posted by "brianmolinaspring (via GitHub)" <gi...@apache.org>.
brianmolinaspring commented on issue #5474:
URL: https://github.com/apache/camel-quarkus/issues/5474#issuecomment-1787687929

   thanks, @ppalaga , your support helped me


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] LocalDateTime not work in Apache Camel quarkus [camel-quarkus]

Posted by "ppalaga (via GitHub)" <gi...@apache.org>.
ppalaga closed issue #5474: LocalDateTime not work in Apache Camel quarkus
URL: https://github.com/apache/camel-quarkus/issues/5474


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] LocalDateTime not work in Apache Camel quarkus [camel-quarkus]

Posted by "ppalaga (via GitHub)" <gi...@apache.org>.
ppalaga commented on issue #5474:
URL: https://github.com/apache/camel-quarkus/issues/5474#issuecomment-1786063145

   Thanks for the report @brianmolinaspring!
   I think the behavior would be the same in JVM mode. Your getCurrentDateTime() method is simply called only once on route creation. 
   To reach what you want, you might use something like the following:
   
   ```
   .log("${bean:myBean.getCurrentDateTime()}")
   
   @Named("myBean")
   @RegisterForReflection
   class MyBean {
     private Timestamp getCurrentDateTime() {
        LocalDateTime now = LocalDateTime.now();
         return Timestamp.valueOf(now);
     }
   }


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org