-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ba55fd6
commit addc4df
Showing
5 changed files
with
100 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
src/main/java/com/sngular/kloadgen/schemaregistry/SchemaRegistryFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.sngular.kloadgen.schemaregistry; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
|
||
import com.sngular.kloadgen.common.SchemaRegistryEnum; | ||
import com.sngular.kloadgen.util.JMeterHelper; | ||
import io.apicurio.registry.rest.client.RegistryClientFactory; | ||
import io.confluent.kafka.schemaregistry.avro.AvroSchemaProvider; | ||
import io.confluent.kafka.schemaregistry.client.CachedSchemaRegistryClient; | ||
import io.confluent.kafka.schemaregistry.json.JsonSchemaProvider; | ||
import io.confluent.kafka.schemaregistry.protobuf.ProtobufSchemaProvider; | ||
|
||
public final class SchemaRegistryFactory { | ||
|
||
private SchemaRegistryFactory() { | ||
} | ||
|
||
public static Object getSchemaRegistryClient(final SchemaRegistryEnum typeEnum, final String url, final Map<String, ?> properties) { | ||
return switch (typeEnum) { | ||
case APICURIO -> RegistryClientFactory.create(url); | ||
case CONFLUENT -> new CachedSchemaRegistryClient(List.of(JMeterHelper.checkPropertyOrVariable(url)), 1000, | ||
List.of(new AvroSchemaProvider(), new JsonSchemaProvider(), new ProtobufSchemaProvider()), properties); | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters