title: Java: Avro event deserializer (flume)
body: <p>I am running a Flume agent, that reads file from disk containing avro records. In my default setup, I had the following:</p>
  
  <pre><code>agent-1.sources.src-1.deserializer.schemaType = LITERAL
  </code></pre>
  
  <p>Which results in a run-time warning:</p>
  
  <pre><code>schemaType set to LITERAL, so storing full Avro schema in the header of each event, which may be inefficient. Consider using the hash of the schema instead of the literal schema
  </code></pre>
  
  <p>Now, when I looked into the <a href="https://flume.apache.org/FlumeUserGuide.html" rel="nofollow">Flume 1.4.0 guide</a>, under Avro EventDeserializer, there is the option to set:</p>
  
  <pre><code>option:        deserializer.schemaType  
  default value: HASH 
  </code></pre>
  
  <p>Description of the option: How the schema is represented. By default, or when the value HASH is specified, the Avro schema is hashed and the hash is stored in every event in the event header “flume.avro.schema.hash”. If LITERAL is specified, the JSON-encoded schema itself is stored in every event in the event header “flume.avro.schema.literal”. Using LITERAL mode is relatively inefficient compared to HASH mode.</p>
  
  <hr>
  
  <p>And now my question.. If I do set this option to HASH, then when I receive these events at my sink, all I have access to from the event headers is something like:</p>
  
  <pre><code>    flume.avro.schema.hash  0911c27606a05f22
  </code></pre>
  
  <p>And at this point, I need the avro schema to be able to deserialize the event body (containing an avro record). How can I use this hash to get my hands on the actual avro schema? Or how can I use this hash when constructing a new GenericDatumReader, that requires the avro schema?</p>