Generating an AVRO avdl file

I have defined Person record as Avro IDL (person.avdl):

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

      

I am creating java files so this generates PersonProtocol.java and Person.java. PersonProtocol.java is an empty file, is there a way I can prevent this file from being generated ...

+3


source to share


1 answer


You cannot exclude the generation of this file as Avro IDL defines the protocol (see here ).

Your PersonProtocol.java is empty because you are not using the RPC that Avro IDL provides.

For example:

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

 string printMessage(string theMessage);    
}

      



Using code generation, you get this particular line that 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 the avro schema (avsc).

+5


source







All Articles