Error when serializing DateTime using AVRO
See original GitHub issueI am using Avro serialization to send a custom object as a message to the broker. One of my properties is DateTime and I am having a serialization error “System.Int64 required to write against Long schema but found System.DateTime in field timestamp”
This is my message:
public class SomeEvent: ISpecificRecord {
....
public DateTime Timestamp { get; set; }
}
Schema defined as per Avro 1.8
{
""name"":""timestamp"",
""type"":
{
""type"" : ""long"", ""logicalType"" : ""timestamp-millis""
}
}
Am I doing something wrong?
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Error serializing Avro message - apache kafka
Finally, I am able to fix this issue. I did one basic mistake with Avro serde. Model classes are automatically generated by avro...
Read more >Avro Schema Serializer and Deserializer
schemas to false disables auto-registration of the event type, so that it does not override the union as the latest schema in the...
Read more >Apache Avro™ 1.8.0 Specification
Decimal; Date; Time (millisecond precision); Time (microsecond precision) ... Errors are serialized using the effective union; however, a protocol's JSON ...
Read more >Types and conversions - Chr.Avro
NET's built-in types, as well as commonly used types like DateTime and Uri , to ... are thrown when errors occur during serialization...
Read more >A Detailed Introduction to Avro Data Format
And what will we do with the serialized data? At some later point, we'll need to deserialize it or read it back from...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I have an open PR for this: https://github.com/confluentinc/avro/pull/14
We couldn’t adopt Avro without it.
sorry for the confusion - have updated the old packages on nuget.org marking them as depreciated.
note that you don’t need to reference the
Apache.Avro
package explicitly (as per the examples in the examples folder) - this is a dependency ofConfluent.SchemaRegistry.Serdes.Avro
and will be included automatically. Also note thatMicrosoft.Avro.Core
isn’t relevant and not used by any Confluent libraries. Finally, you don’t need to referenceConfluent.SchemaRegistry
- it’s a dependency ofConfluent.SchemaRegistry.Serdes.Avro
.