[ 
https://issues.apache.org/jira/browse/FLINK-15941?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17032349#comment-17032349
 ] 

Robert Metzger commented on FLINK-15941:
----------------------------------------

Note: This issue has been reported by a user on the mailing list: 
https://lists.apache.org/thread.html/r41ca967ae6a1f5382d77daf2a8d593e3f3aaaac5adf6adf35ed941e6%40%3Cuser.flink.apache.org%3E

There's another suggestion how to resolve the issue on the list.

> ConfluentSchemaRegistryCoder should not perform HTTP requests for all request
> -----------------------------------------------------------------------------
>
>                 Key: FLINK-15941
>                 URL: https://issues.apache.org/jira/browse/FLINK-15941
>             Project: Flink
>          Issue Type: Improvement
>          Components: Formats (JSON, Avro, Parquet, ORC, SequenceFile)
>            Reporter: Dawid Wysakowicz
>            Priority: Major
>
> ConfluentSchemaRegistryCoder should cache ids of schemas that it has already 
> seen.
> I think it should be as simple as changing
> {code}
>       @Override
>       public void writeSchema(Schema schema, OutputStream out) throws 
> IOException {
>               try {
>                       int registeredId = 
> schemaRegistryClient.register(subject, schema);
>                       out.write(CONFLUENT_MAGIC_BYTE);
>                       byte[] schemaIdBytes = 
> ByteBuffer.allocate(4).putInt(registeredId).array();
>                       out.write(schemaIdBytes);
>               } catch (RestClientException e) {
>                       throw new IOException("Could not register schema in 
> registry", e);
>               }
>       }
> {code}
> to
> {code}
>       @Override
>       public void writeSchema(Schema schema, OutputStream out) throws 
> IOException {
>               try {
>                       int registeredId = schemaRegistryClient.getId(subject, 
> schema);
>                       out.write(CONFLUENT_MAGIC_BYTE);
>                       byte[] schemaIdBytes = 
> ByteBuffer.allocate(4).putInt(registeredId).array();
>                       out.write(schemaIdBytes);
>               } catch (RestClientException e) {
>                       throw new IOException("Could not register schema in 
> registry", e);
>               }
>       }
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to