Bernd
November 9, 2019
In a previous post we spoke about Avro and how we started to use it together with our REST API based micro services. As it soon turned out, this tool also has some corners and edges, which are advantageous to know. Using the default configuration we found an issue working with Maps used in the generated code.
In regard to this it is important to know that out of the box Avro (we currently use version 1.8.2)
This caused some problems for us, e.g. retrieving values by key from Maps did not work in a straight forward way anymore.
We resolved these problems by configuring Avro to use String instead of CharSequence in the configuration of the avro-maven-plugin used in out Maven build.
<plugin></plugin>
<groupid>org.apache.avro</groupid>
<artifactid>avro-maven-plugin</artifactid>
<version>1.8.2</version>
<executions></executions>
<execution></execution>
<id>schemas</id>
<phase>generate-sources</phase>
<goals></goals>
<goal>schema</goal>
<configuration></configuration>
<stringtype>String</stringtype>
<sourcedirectory>${project.basedir}/src/main/avro</sourcedirectory>
...
With the configuration change described above we are now able to use Avro in a way fitting all of our requirements in development.
Working as a software engineer for many years mostly in the JVM environment. Skilled in Scrum and Agile practices, currently scrum master of nerd.vision.