You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by GitBox <gi...@apache.org> on 2020/10/08 13:27:18 UTC

[GitHub] [camel-kafka-connector] lburgazzoli opened a new issue #544: source: better handling of headers of type Data

lburgazzoli opened a new issue #544:
URL: https://github.com/apache/camel-kafka-connector/issues/544


   In the `CamelSourceTask`, if a Camel's header is of type date, it gets propagated as a string to Kafka with something like:
   
   ```java
   if (value instanceof Date) {
       record.headers().addString(
           keyCamelHeader, 
           new SimpleDateFormat("yyyy-MM-dd").format(value));
   }
   ```
   
   this approach has some issues:
   
   1. the consumer is not able to know the real type of the header as it is just a string
   2. we lose precision as we remove the time of the day
   
   As Kafka support date and time with `org.apache.kafka.connect.data.[Data|Time]`, we should probably avoid to use a string to represent dates however to fully translate a `java.util.Date` to the related Kafka types, we'd need to split it to multiple headers keys or using multiple headers for the same value.
   
   I don't have enough knowledge at the moment about what could be the best solution but at least we should start by not losing the type.  
   


----------------------------------------------------------------
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.

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



[GitHub] [camel-kafka-connector] lburgazzoli closed issue #544: source: better handling of headers of type Data

Posted by GitBox <gi...@apache.org>.
lburgazzoli closed issue #544:
URL: https://github.com/apache/camel-kafka-connector/issues/544


   


----------------------------------------------------------------
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.

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



[GitHub] [camel-kafka-connector] lburgazzoli commented on issue #544: source: better handling of headers of type Data

Posted by GitBox <gi...@apache.org>.
lburgazzoli commented on issue #544:
URL: https://github.com/apache/camel-kafka-connector/issues/544#issuecomment-705633524


   It turn out that it it much simpler as there is `org.apache.kafka.connect.data.Timestamp` that represent a date.
   However we should remove support for `java.sql.Date` and `java.sql.Timestamp`


----------------------------------------------------------------
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.

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



[GitHub] [camel-kafka-connector] lburgazzoli closed issue #544: source: better handling of headers of type Data

Posted by GitBox <gi...@apache.org>.
lburgazzoli closed issue #544:
URL: https://github.com/apache/camel-kafka-connector/issues/544


   


----------------------------------------------------------------
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.

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



[GitHub] [camel-kafka-connector] lburgazzoli commented on issue #544: source: better handling of headers of type Data

Posted by GitBox <gi...@apache.org>.
lburgazzoli commented on issue #544:
URL: https://github.com/apache/camel-kafka-connector/issues/544#issuecomment-705633524


   It turn out that it it much simpler as there is `org.apache.kafka.connect.data.Timestamp` that represent a date.
   However we should remove support for `java.sql.Date` and `java.sql.Timestamp`


----------------------------------------------------------------
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.

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