question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error when serializing DateTime using AVRO

See original GitHub issue

I 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:open
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
timjrobertscommented, Apr 9, 2019

I have an open PR for this: https://github.com/confluentinc/avro/pull/14

We couldn’t adopt Avro without it.

2reactions
mhowlettcommented, Nov 30, 2020

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 of Confluent.SchemaRegistry.Serdes.Avro and will be included automatically. Also note that Microsoft.Avro.Core isn’t relevant and not used by any Confluent libraries. Finally, you don’t need to reference Confluent.SchemaRegistry - it’s a dependency of Confluent.SchemaRegistry.Serdes.Avro.

Read more comments on GitHub >

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

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found