Search in sources :

Example 1 with EventMetadataValidationStrategy

use of org.zalando.nakadi.validation.EventMetadataValidationStrategy in project nakadi by zalando.

the class EventTypeCacheTest method initValidation.

@BeforeClass
public static void initValidation() {
    ValidationStrategy.register(EventBodyMustRespectSchema.NAME, new EventBodyMustRespectSchema(new JsonSchemaEnrichment()));
    ValidationStrategy.register(EventMetadataValidationStrategy.NAME, new EventMetadataValidationStrategy());
}
Also used : JsonSchemaEnrichment(org.zalando.nakadi.validation.JsonSchemaEnrichment) EventBodyMustRespectSchema(org.zalando.nakadi.validation.EventBodyMustRespectSchema) EventMetadataValidationStrategy(org.zalando.nakadi.validation.EventMetadataValidationStrategy) BeforeClass(org.junit.BeforeClass)

Example 2 with EventMetadataValidationStrategy

use of org.zalando.nakadi.validation.EventMetadataValidationStrategy in project nakadi by zalando.

the class RepositoriesConfig method eventTypeCache.

@Bean
public EventTypeCache eventTypeCache(final ZooKeeperHolder zooKeeperHolder, @DB final EventTypeRepository eventTypeRepository, @DB final TimelineDbRepository timelineRepository, final TimelineSync timelineSync) {
    ValidationStrategy.register(EventBodyMustRespectSchema.NAME, new EventBodyMustRespectSchema(new JsonSchemaEnrichment()));
    ValidationStrategy.register(EventMetadataValidationStrategy.NAME, new EventMetadataValidationStrategy());
    try {
        return new EventTypeCache(eventTypeRepository, timelineRepository, zooKeeperHolder, timelineSync);
    } catch (final Exception e) {
        throw new IllegalStateException("failed to create event type cache", e);
    }
}
Also used : JsonSchemaEnrichment(org.zalando.nakadi.validation.JsonSchemaEnrichment) EventBodyMustRespectSchema(org.zalando.nakadi.validation.EventBodyMustRespectSchema) EventMetadataValidationStrategy(org.zalando.nakadi.validation.EventMetadataValidationStrategy) EventTypeCache(org.zalando.nakadi.repository.db.EventTypeCache) Bean(org.springframework.context.annotation.Bean)

Aggregations

EventBodyMustRespectSchema (org.zalando.nakadi.validation.EventBodyMustRespectSchema)2 EventMetadataValidationStrategy (org.zalando.nakadi.validation.EventMetadataValidationStrategy)2 JsonSchemaEnrichment (org.zalando.nakadi.validation.JsonSchemaEnrichment)2 BeforeClass (org.junit.BeforeClass)1 Bean (org.springframework.context.annotation.Bean)1 EventTypeCache (org.zalando.nakadi.repository.db.EventTypeCache)1