0
votes

I have AVRO protocol like this:

{
  "namespace": "org.apache.camel.avro.generated",
  "protocol": "KeyValueProtocol",
  "types": [
    {
      "name": "Key", "type": "record",
      "fields": [
        { "name": "key", "type": "string"}
      ]
    },
    {
      "name": "Value", "type": "record",
      "fields": [
        { "name": "value", "type": "string"}
      ]
    }
  ],
  "messages": {
    "put": {
      "request": [{"name": "key", "type": "Key"}, {"name": "value", "type": "Value"} ],
      "response": "null"
    },
    "get": {
      "request": [{"name": "key", "type": "Key"}],
      "response": "Value"
    }
  }
}

Camel route:

import org.apache.camel.builder.RouteBuilder; 
import org.springframework.stereotype.Component;

@Component public class Computations extends RouteBuilder {


    @Override
    public void configure() throws Exception {
        from("avro:http:localhost:12345?protocol=KeyValueProtocol")
                .process(exchange->{
                    System.out.println(exchange);
                })
                .to("log:foo")
                .end();
    } }

and during compilation I got error:

[ERROR] Failed to execute goal org.apache.avro:avro-maven-plugin:1.8.2:schema (default) on project tradersbook-mt-common-computations: Execution default of goal org.apache.avro:avro-maven-plugin:1.8.2:schema failed: No type: {"namespace":"org.apache.camel.avro.generated","protocol":"KeyValueProtocol","types":[{"name":"Key","type":"record","fields":[{"name":"key","type":"string"}]},{"name":"Value","type":"record","fields":[{"name":"value","type":"string"}]}],"messages":{"put":{"request":[{"name":"key","type":"Key"},{"name":"value","type":"Value"}],"response":"null"},"get":{"request":[{"name":"key","type":"Key"}],"response":"Value"}}} -> [Help 1]

dependencies:

[INFO] +- org.apache.camel:camel-core:jar:2.18.5:compile

[INFO] +- org.apache.avro:avro:jar:1.8.2:compile

any advice ?

1

1 Answers

0
votes

In my case only issue was that my file had wrong extension. Protocol cannot be in file with extension '.avsc'

'.avpr' and '.avdl' are working fine with maven plugin (fine == 'no errors during compilation')

Looks like change of this extension provide to ignore this data by plugin.