Conversion from an .avsc file to a Java file using Maven

479 views Asked by At

I created a .avsc file and I declared the following field: { "name": "event_time", "type": { "type" : "long", "logicalType": "timestamp-millis"}, "doc": "The timestamp when the event was registered." }

When the package instruction from maven is executed, the following field is created: private DateTime event_time;

Then, the conversion from DateTime to Long is realized using the following code:

this.event_time = (DateTime)value$;

This line of code throws an exception when it is executed because the Long object cannot be converted into a DateTime object in this manner.

I would like to know if it is possible to rewrite the class which is generated from the .avsc file using the command package. This class is in the target folder.

Otherwise I would like to know what other possible options exist for sending a timestamp using AVRO.

0

There are 0 answers