public ContentType getMediaType(pl.allegro.tech.hermes.api.ContentType contentType) { return AVRO.equals(contentType) ? ContentType.create(AVRO_BINARY) : ContentType.APPLICATION_JSON; } }
public ContentType getMediaType(pl.allegro.tech.hermes.api.ContentType contentType) { return AVRO.equals(contentType) ? ContentType.create(AVRO_BINARY) : ContentType.APPLICATION_JSON; } }
public TopicWithSchema getTopicWithSchema(TopicName topicName) { Topic topic = getTopicDetails(topicName); Optional<RawSchema> schema = Optional.empty(); if (AVRO.equals(topic.getContentType())) { schema = schemaService.getSchema(topicName.qualifiedName()); } return schema .map(s -> topicWithSchema(topic, s.value())) .orElseGet(() -> topicWithSchema(topic)); }
private void removeSchema(Topic topic) { if (AVRO.equals(topic.getContentType()) && topicProperties.isRemoveSchema()) { schemaService.getSchema(topic.getQualifiedName()).ifPresent(s -> schemaService.deleteAllSchemaVersions(topic.getQualifiedName())); } }
public void updateTopicWithSchema(TopicName topicName, PatchData patch, String modifiedBy) { Topic topic = getTopicDetails(topicName); boolean validateAvroSchema = AVRO.equals(topic.getContentType()); extractSchema(patch) .ifPresent(schema -> { schemaService.registerSchema(topic, schema, validateAvroSchema); scheduleTouchTopic(topicName); }); updateTopic(topicName, patch, modifiedBy); }
public void createTopicWithSchema(TopicWithSchema topicWithSchema, String createdBy, CreatorRights isAllowedToManage) { Topic topic = topicWithSchema.getTopic(); topicValidator.ensureCreatedTopicIsValid(topic, isAllowedToManage); ensureTopicDoesNotExist(topic); boolean validateAndRegisterSchema = AVRO.equals(topic.getContentType()) || (topic.isJsonToAvroDryRunEnabled() && topicWithSchema.getSchema() != null); validateSchema(validateAndRegisterSchema, topicWithSchema, topic); registerAvroSchema(validateAndRegisterSchema, topicWithSchema, createdBy); createTopic(topic, createdBy); }