Skip to content

Commit

Permalink
1569 | Import order fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
adriansobolewski committed Oct 18, 2023
1 parent 23b4ba8 commit 6867e5f
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,12 @@ static HermesServer provideHermesServer() throws IOException {
MetricsFacade metricsFacade = new MetricsFacade(new SimpleMeterRegistry(), hermesMetrics);
TopicsCache topicsCache = new InMemoryTopicsCache(metricsFacade, topic);
BrokerMessageProducer brokerMessageProducer = new InMemoryBrokerMessageProducer();
RawSchemaAdminClient rawSchemaAdminClient = new InMemorySchemaAdminClient(topic.getName(), loadMessageResource("schema"), 1, 1);
RawSchemaAdminClient rawSchemaAdminClient = new InMemorySchemaAdminClient(
topic.getName(),
loadMessageResource("schema"),
1,
1
);
Trackers trackers = new Trackers(Collections.emptyList());
AvroMessageContentWrapper avroMessageContentWrapper = new AvroMessageContentWrapper(Clock.systemDefaultZone());
HttpHandler httpHandler = provideHttpHandler(
Expand Down Expand Up @@ -85,7 +90,8 @@ static HermesServer provideHermesServer() throws IOException {

private static HttpHandler provideHttpHandler(ThroughputLimiter throughputLimiter,
TopicsCache topicsCache, BrokerMessageProducer brokerMessageProducer,
RawSchemaAdminClient rawSchemaAdminClient, Trackers trackers, AvroMessageContentWrapper avroMessageContentWrapper) {
RawSchemaAdminClient rawSchemaAdminClient, Trackers trackers,
AvroMessageContentWrapper avroMessageContentWrapper) {
HeaderPropagationProperties headerPropagationProperties = new HeaderPropagationProperties();
HandlersChainProperties handlersChainProperties = new HandlersChainProperties();
TrackingHeadersExtractor trackingHeadersExtractor = new DefaultTrackingHeaderExtractor();
Expand All @@ -100,9 +106,15 @@ private static HttpHandler provideHttpHandler(ThroughputLimiter throughputLimite
new MessageContentTypeEnforcer(),
new SchemaRepository(
new DirectSchemaVersionsRepository(rawSchemaAdminClient),
new DirectCompiledSchemaRepository<>(rawSchemaAdminClient, SchemaCompilersFactory.avroSchemaCompiler())
new DirectCompiledSchemaRepository<>(
rawSchemaAdminClient,
SchemaCompilersFactory.avroSchemaCompiler()
)
),
new DefaultHeadersPropagator(
headerPropagationProperties.isEnabled(),
headerPropagationProperties.getAllowFilter()
),
new DefaultHeadersPropagator(headerPropagationProperties.isEnabled(), headerPropagationProperties.getAllowFilter()),
new BenchmarkMessageContentWrapper(avroMessageContentWrapper),
Clock.systemDefaultZone(),
schemaProperties.isIdHeaderEnabled()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
package pl.allegro.tech.hermes.common.schema;

import java.util.List;
import java.util.Optional;
import java.util.function.Supplier;
import pl.allegro.tech.hermes.api.RawSchemaWithMetadata;
import pl.allegro.tech.hermes.api.TopicName;
import pl.allegro.tech.hermes.common.metric.MetricsFacade;
Expand All @@ -12,6 +9,10 @@
import pl.allegro.tech.hermes.schema.SchemaId;
import pl.allegro.tech.hermes.schema.SchemaVersion;

import java.util.List;
import java.util.Optional;
import java.util.function.Supplier;

public class ReadMetricsTrackingRawSchemaClient implements RawSchemaClient {
private final MetricsFacade metricsFacade;
protected final RawSchemaClient rawSchemaClient;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import com.fasterxml.jackson.jakarta.rs.json.JacksonJsonProvider;
import jakarta.ws.rs.client.Client;
import jakarta.ws.rs.client.ClientBuilder;
import java.net.URI;
import org.apache.avro.Schema;
import org.glassfish.jersey.client.ClientConfig;
import org.glassfish.jersey.client.ClientProperties;
Expand All @@ -30,6 +29,8 @@
import pl.allegro.tech.hermes.schema.resolver.DefaultSchemaRepositoryInstanceResolver;
import pl.allegro.tech.hermes.schema.resolver.SchemaRepositoryInstanceResolver;

import java.net.URI;

import static pl.allegro.tech.hermes.schema.SubjectNamingStrategy.qualifiedName;

@Configuration
Expand Down Expand Up @@ -70,8 +71,10 @@ public RawSchemaAdminClient schemaRegistryRawSchemaAdminClient(
ObjectMapper objectMapper,
SubjectNamingStrategy subjectNamingStrategy
) {
return new SchemaRegistryRawSchemaAdminClient(schemaRepositoryInstanceResolver, objectMapper,
schemaRepositoryProperties.isValidationEnabled(), schemaRepositoryProperties.getDeleteSchemaPathSuffix(),
return new SchemaRegistryRawSchemaAdminClient(schemaRepositoryInstanceResolver,
objectMapper,
schemaRepositoryProperties.isValidationEnabled(),
schemaRepositoryProperties.getDeleteSchemaPathSuffix(),
subjectNamingStrategy);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package pl.allegro.tech.hermes.schema;

import java.util.List;
import java.util.Optional;
import pl.allegro.tech.hermes.api.RawSchemaWithMetadata;
import pl.allegro.tech.hermes.api.TopicName;

import java.util.List;
import java.util.Optional;

public interface RawSchemaClient {

Optional<RawSchemaWithMetadata> getRawSchemaWithMetadata(TopicName topic, SchemaVersion version);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import jakarta.ws.rs.client.Entity;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.Response;
import java.io.IOException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import pl.allegro.tech.hermes.api.RawSchema;
Expand All @@ -15,6 +14,8 @@
import pl.allegro.tech.hermes.schema.SubjectNamingStrategy;
import pl.allegro.tech.hermes.schema.resolver.SchemaRepositoryInstanceResolver;

import java.io.IOException;

import static jakarta.ws.rs.core.Response.Status.BAD_REQUEST;
import static jakarta.ws.rs.core.Response.Status.Family.SUCCESSFUL;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@
import jakarta.ws.rs.client.Entity;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.Response;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import pl.allegro.tech.hermes.api.RawSchema;
Expand All @@ -21,8 +15,15 @@
import pl.allegro.tech.hermes.schema.SubjectNamingStrategy;
import pl.allegro.tech.hermes.schema.resolver.SchemaRepositoryInstanceResolver;

import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;

/**
* This implementation of RawSchemaClient is compatible with Confluent Schema Registry API
* This implementation of RawSchemaClient is compatible with Confluent Schema Registry API.
*/
public class SchemaRegistryRawSchemaClient implements RawSchemaClient {

Expand Down

0 comments on commit 6867e5f

Please sign in to comment.