Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AVRO avdl file generation

Tags:

java

hadoop

avro

I Defined a Person record as Avro IDL (person.avdl):

@namespace("net.tzolov.avro.extend")
protocol PersonProtocol {
    record Person {
        string firstName;
        string lastName;
    }     
}

I am generating the java files, so this one is generating PersonProtocol.java and Person.java. The PersonProtocol.java is empty file, is there a way I can exclude generating this file...

like image 694
Ikshvak Avatar asked Nov 21 '25 19:11

Ikshvak


1 Answers

You can't exclude the generation of this file because Avro IDL defines a protocol (see more here).

Your PersonProtocol.java is empty because you don't use the RPCs that provides Avro IDL language.

For example:

@namespace("net.tzolov.avro.extend")
protocol PersonProtocol {
 record Person {
    string firstName;
    string lastName;
 }

 string printMessage(string theMessage);    
}

By using the code generation, you will obtain this particular line which defines the RPC method :

void printMessage(java.lang.CharSequence theMessage, org.apache.avro.ipc.Callback<java.lang.CharSequence> callback) throws java.io.IOException;

If you just want to store data, you should use avro schema (avsc).

like image 158
Gaetan E. Avatar answered Nov 24 '25 09:11

Gaetan E.



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!