Skip to content

Commit

Permalink
merge in latest code
Browse files Browse the repository at this point in the history
Signed-off-by: David Radley <david_radley@uk.ibm.com>
  • Loading branch information
davidradl committed Apr 26, 2024
1 parent dffbc79 commit 8accc78
Showing 1 changed file with 13 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,6 @@ public static byte[] longToBytes(long x) {
return buffer.array();
}

public static byte[] intToBytes(int x) {
ByteBuffer buffer = ByteBuffer.allocate(Integer.BYTES);
buffer.putInt(x);
return buffer.array();
}

/**
* Get the Avro schema using the Apicurio Registry. In order to call the registry, we need to
* get the globalId of the Avro Schema in the registry. If the format is configured to expect
Expand Down Expand Up @@ -175,13 +169,20 @@ public Schema readSchemaWithAdditionalParameters(
InputStream schemaInputStream = registryClient.getContentByGlobalId(schemaId, true, true);
Schema schema = new Schema.Parser().parse(schemaInputStream);
if (LOG.isDebugEnabled()) {
LOG.debug(methodName + " got schema " + schema + " using globalId " + schemaId);
LOG.debug(
methodName
+ " got schema "
+ schema
+ " using "
+ (useGlobalId ? "global" : "content")
+ " ID "
+ schemaId);
}
return schema;
}

/**
* get the schema id.
* Get the schema id.
*
* @param in the Kafka body as an input stream
* @param additionalParameters additional Pararamters containing the headers and whetehr we are
Expand Down Expand Up @@ -250,8 +251,7 @@ protected long getSchemaId(
throw new IOException(
"Unknown data format. Magic number was not found. "
+ USE_HEADERS
+ "="
+ useHeaders
+ "= false"
+ " configs="
+ configs);
}
Expand Down Expand Up @@ -283,6 +283,9 @@ public void writeSchema(
Map<String, Object> outputProperties)
throws IOException {
String methodName = "writeSchema with additional properties";
if (LOG.isDebugEnabled()) {
LOG.debug(methodName + " entered");
}

boolean useHeaders = (boolean) configs.get(USE_HEADERS.key());
boolean useGlobalId = (boolean) configs.get(USE_GLOBALID.key());
Expand Down

0 comments on commit 8accc78

Please sign in to comment.