Question

I have an Apache AVRO IDL that defines a protocol that I would like to use between a java client and a server written in Python.

@namespace("myproto.proto")

protocol myproto 
{

  enum Status
  {
    STATUS_OK,
    STATUS_ERROR
  }

  record GameList
  {
    array<string> games;
  }

  void somefunc(int arg);
}

For Python, I use this:

AVROTOOLS=$(TOOLS_PATH)/avro-tools-1.7.4.jar
java -jar $(AVROTOOLS) idl fairunfair.avdl fairunfair.avpr

How can I compile the IDL into Java? Without using maven, if possible.

Was it helpful?

Solution

You can generate a JSON schema from your IDL with avro-tools:

java -jar avro-tools-1.7.4.jar idl /path/to/idl

Then just compile the schema into Java as usual:

java -jar avro-tools-1.7.4.jar compile schema /path/to/schema .

I don't think there is any way to compile directly to Java from IDL. The avro-tools help menu reveals no such option.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top