Loading .gitlab-ci.yml +1 −1 Original line number Diff line number Diff line Loading @@ -3,7 +3,7 @@ stages: maven-build: stage: build image: redmic/maven-gitlab image: registry.gitlab.com/redmic-project/docker/maven variables: MAVEN_OPTS: "-Dmaven.repo.local=.m2/repository" only: Loading pom.xml +81 −17 Original line number Diff line number Diff line <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.0.0.RELEASE</version> <version>2.0.3.RELEASE</version> <relativePath /> </parent> Loading @@ -23,12 +24,16 @@ <java.version>1.8</java.version> <!-- REDMIC --> <redmic.exceptions.version>0.6.0</redmic.exceptions.version> <redmic.jackson-jsonschema.version>0.6.0</redmic.jackson-jsonschema.version> <!-- OTHERS --> <avro.version>1.8.2</avro.version> <confluent.version>4.0.0</confluent.version> <confluent.version>5.0.0</confluent.version> <kafka.version>1.1.0</kafka.version> <hibernate-validator.version>6.0.8.Final</hibernate-validator.version> <geotools.version>19.0</geotools.version> <jackson-datatype-jts.version>2.4</jackson-datatype-jts.version> <!-- Version plugins --> <jacoco.version>0.8.1</jacoco.version> Loading @@ -38,19 +43,48 @@ </properties> <dependencies> <!-- REDMIC library --> <dependency> <groupId>es.redmic.lib</groupId> <artifactId>exceptions</artifactId> <version>${redmic.exceptions.version}</version> <scope>provided</scope> </dependency> <dependency> <groupId>es.redmic.lib</groupId> <artifactId>jackson-jsonschema</artifactId> <version>${redmic.jackson-jsonschema.version}</version> </dependency> <!-- Others --> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-databind</artifactId> <scope>provided</scope> </dependency> <dependency> <groupId>com.fasterxml.jackson.datatype</groupId> <artifactId>jackson-datatype-joda</artifactId> </dependency> <dependency> <groupId>com.fasterxml.jackson.dataformat</groupId> <artifactId>jackson-dataformat-avro</artifactId> </dependency> <dependency> <groupId>com.bedatadriven</groupId> <artifactId>jackson-datatype-jts</artifactId> <version>${jackson-datatype-jts.version}</version> <exclusions> <exclusion> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-databind</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>javax.validation</groupId> <artifactId>validation-api</artifactId> Loading @@ -66,6 +100,16 @@ <groupId>org.springframework.kafka</groupId> <artifactId>spring-kafka</artifactId> </dependency> <!-- Override kafkaClient version --> <dependency> <groupId>org.apache.kafka</groupId> <artifactId>kafka-clients</artifactId> </dependency> <!-- --> <dependency> <groupId>io.confluent</groupId> <artifactId>common-config</artifactId> Loading Loading @@ -104,6 +148,19 @@ <version>${avro.version}</version> </dependency> <!-- GeoTools --> <dependency> <groupId>org.geotools</groupId> <artifactId>gt-wms</artifactId> <version>${geotools.version}</version> <exclusions> <exclusion> <groupId>commons-io</groupId> <artifactId>commons-io</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-validator</artifactId> Loading Loading @@ -142,6 +199,13 @@ <uniqueVersion>false</uniqueVersion> </snapshotRepository> </distributionManagement> <repositories> <repository> <id>confluent</id> <name>Confluent</name> <url>https://packages.confluent.io/maven/</url> </repository> </repositories> <build> <plugins> <plugin> Loading src/main/java/es/redmic/brokerlib/alert/AlertService.java +7 −1 Original line number Diff line number Diff line Loading @@ -18,12 +18,18 @@ public class AlertService { @Value("${alert.email}") private String ALERT_EMAIL; @Value("${spring.profiles.active}") private String PROFILE_ACTIVE; @Autowired private KafkaTemplate<String, Message> kafkaTemplate; public void errorAlert(String subject, String message) { String subjectDefault = "[ERROR] "; if (PROFILE_ACTIVE.equals("test")) ALERT_EMAIL = "test@redmic.es"; String subjectDefault = "[ERROR][" + PROFILE_ACTIVE + "] "; send(new Message(ALERT_EMAIL, subjectDefault + subject, message, AlertType.ERROR.name())); } Loading src/main/java/es/redmic/brokerlib/avro/common/CommonDTO.java +4 −0 Original line number Diff line number Diff line Loading @@ -6,6 +6,10 @@ import com.kjetland.jackson.jsonSchema.annotations.JsonSchemaNotNull; public abstract class CommonDTO extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord { public CommonDTO() { super(); } private String id; public String getId() { Loading src/main/java/es/redmic/brokerlib/avro/common/EventTypes.java 0 → 100644 +64 −0 Original line number Diff line number Diff line package es.redmic.brokerlib.avro.common; public abstract class EventTypes { public static String // @formatter:off //CREATE CREATE = "CREATE", ENRICH_CREATE = "ENRICH_CREATE", CREATE_ENRICHED = "CREATE_ENRICHED", CREATE_ENRICH_FAILED = "CREATE_ENRICH_FAILED", CREATE_CONFIRMED = "CREATE_CONFIRMED", CREATED = "CREATED", CREATE_FAILED = "CREATE_FAILED", CREATE_CANCELLED = "CREATE_CANCELLED", //UPDATE UPDATE = "UPDATE", ENRICH_UPDATE = "ENRICH_UPDATE", UPDATE_ENRICHED = "UPDATE_ENRICHED", UPDATE_ENRICH_FAILED = "UPDATE_ENRICH_FAILED", UPDATE_CONFIRMED = "UPDATE_CONFIRMED", UPDATED = "UPDATED", UPDATE_FAILED = "UPDATE_FAILED", UPDATE_CANCELLED = "UPDATE_CANCELLED", //DELETE DELETE = "DELETE", CHECK_DELETE = "CHECK_DELETE", DELETE_CHECKED = "DELETE_CHECKED", DELETE_CHECK_FAILED = "DELETE_CHECK_FAILED", DELETE_CONFIRMED = "DELETE_CONFIRMED", DELETED = "DELETED", DELETE_FAILED = "DELETE_FAILED", DELETE_CANCELLED = "DELETE_CANCELLED"; //@formatter:on /** * Función que identifica si un evento no corresponde con el final de un ciclo * * @param eventType * tipo de evento * @return true si el tipo coincide con un evento final, false en caso contrario **/ protected static boolean isLocked(String eventType) { return !(eventType.equals(EventTypes.CREATED.toString()) || eventType.equals(EventTypes.UPDATED.toString()) || eventType.equals(EventTypes.CREATE_CANCELLED.toString()) || eventType.equals(EventTypes.UPDATE_CANCELLED.toString()) || eventType.equals(EventTypes.DELETE_CANCELLED.toString())); } /** * Función que identifica si un evento contiene el último estado correcto del * elemento * * @param eventType * tipo de evento * @return true si el tipo coincide con snapshot, false en caso contrario **/ protected static boolean isSnapshot(String eventType) { return (eventType.equals(EventTypes.CREATED.toString()) || eventType.equals(EventTypes.UPDATED.toString()) || eventType.equals(EventTypes.DELETED.toString())); } } Loading
.gitlab-ci.yml +1 −1 Original line number Diff line number Diff line Loading @@ -3,7 +3,7 @@ stages: maven-build: stage: build image: redmic/maven-gitlab image: registry.gitlab.com/redmic-project/docker/maven variables: MAVEN_OPTS: "-Dmaven.repo.local=.m2/repository" only: Loading
pom.xml +81 −17 Original line number Diff line number Diff line <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.0.0.RELEASE</version> <version>2.0.3.RELEASE</version> <relativePath /> </parent> Loading @@ -23,12 +24,16 @@ <java.version>1.8</java.version> <!-- REDMIC --> <redmic.exceptions.version>0.6.0</redmic.exceptions.version> <redmic.jackson-jsonschema.version>0.6.0</redmic.jackson-jsonschema.version> <!-- OTHERS --> <avro.version>1.8.2</avro.version> <confluent.version>4.0.0</confluent.version> <confluent.version>5.0.0</confluent.version> <kafka.version>1.1.0</kafka.version> <hibernate-validator.version>6.0.8.Final</hibernate-validator.version> <geotools.version>19.0</geotools.version> <jackson-datatype-jts.version>2.4</jackson-datatype-jts.version> <!-- Version plugins --> <jacoco.version>0.8.1</jacoco.version> Loading @@ -38,19 +43,48 @@ </properties> <dependencies> <!-- REDMIC library --> <dependency> <groupId>es.redmic.lib</groupId> <artifactId>exceptions</artifactId> <version>${redmic.exceptions.version}</version> <scope>provided</scope> </dependency> <dependency> <groupId>es.redmic.lib</groupId> <artifactId>jackson-jsonschema</artifactId> <version>${redmic.jackson-jsonschema.version}</version> </dependency> <!-- Others --> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-databind</artifactId> <scope>provided</scope> </dependency> <dependency> <groupId>com.fasterxml.jackson.datatype</groupId> <artifactId>jackson-datatype-joda</artifactId> </dependency> <dependency> <groupId>com.fasterxml.jackson.dataformat</groupId> <artifactId>jackson-dataformat-avro</artifactId> </dependency> <dependency> <groupId>com.bedatadriven</groupId> <artifactId>jackson-datatype-jts</artifactId> <version>${jackson-datatype-jts.version}</version> <exclusions> <exclusion> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-databind</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>javax.validation</groupId> <artifactId>validation-api</artifactId> Loading @@ -66,6 +100,16 @@ <groupId>org.springframework.kafka</groupId> <artifactId>spring-kafka</artifactId> </dependency> <!-- Override kafkaClient version --> <dependency> <groupId>org.apache.kafka</groupId> <artifactId>kafka-clients</artifactId> </dependency> <!-- --> <dependency> <groupId>io.confluent</groupId> <artifactId>common-config</artifactId> Loading Loading @@ -104,6 +148,19 @@ <version>${avro.version}</version> </dependency> <!-- GeoTools --> <dependency> <groupId>org.geotools</groupId> <artifactId>gt-wms</artifactId> <version>${geotools.version}</version> <exclusions> <exclusion> <groupId>commons-io</groupId> <artifactId>commons-io</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-validator</artifactId> Loading Loading @@ -142,6 +199,13 @@ <uniqueVersion>false</uniqueVersion> </snapshotRepository> </distributionManagement> <repositories> <repository> <id>confluent</id> <name>Confluent</name> <url>https://packages.confluent.io/maven/</url> </repository> </repositories> <build> <plugins> <plugin> Loading
src/main/java/es/redmic/brokerlib/alert/AlertService.java +7 −1 Original line number Diff line number Diff line Loading @@ -18,12 +18,18 @@ public class AlertService { @Value("${alert.email}") private String ALERT_EMAIL; @Value("${spring.profiles.active}") private String PROFILE_ACTIVE; @Autowired private KafkaTemplate<String, Message> kafkaTemplate; public void errorAlert(String subject, String message) { String subjectDefault = "[ERROR] "; if (PROFILE_ACTIVE.equals("test")) ALERT_EMAIL = "test@redmic.es"; String subjectDefault = "[ERROR][" + PROFILE_ACTIVE + "] "; send(new Message(ALERT_EMAIL, subjectDefault + subject, message, AlertType.ERROR.name())); } Loading
src/main/java/es/redmic/brokerlib/avro/common/CommonDTO.java +4 −0 Original line number Diff line number Diff line Loading @@ -6,6 +6,10 @@ import com.kjetland.jackson.jsonSchema.annotations.JsonSchemaNotNull; public abstract class CommonDTO extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord { public CommonDTO() { super(); } private String id; public String getId() { Loading
src/main/java/es/redmic/brokerlib/avro/common/EventTypes.java 0 → 100644 +64 −0 Original line number Diff line number Diff line package es.redmic.brokerlib.avro.common; public abstract class EventTypes { public static String // @formatter:off //CREATE CREATE = "CREATE", ENRICH_CREATE = "ENRICH_CREATE", CREATE_ENRICHED = "CREATE_ENRICHED", CREATE_ENRICH_FAILED = "CREATE_ENRICH_FAILED", CREATE_CONFIRMED = "CREATE_CONFIRMED", CREATED = "CREATED", CREATE_FAILED = "CREATE_FAILED", CREATE_CANCELLED = "CREATE_CANCELLED", //UPDATE UPDATE = "UPDATE", ENRICH_UPDATE = "ENRICH_UPDATE", UPDATE_ENRICHED = "UPDATE_ENRICHED", UPDATE_ENRICH_FAILED = "UPDATE_ENRICH_FAILED", UPDATE_CONFIRMED = "UPDATE_CONFIRMED", UPDATED = "UPDATED", UPDATE_FAILED = "UPDATE_FAILED", UPDATE_CANCELLED = "UPDATE_CANCELLED", //DELETE DELETE = "DELETE", CHECK_DELETE = "CHECK_DELETE", DELETE_CHECKED = "DELETE_CHECKED", DELETE_CHECK_FAILED = "DELETE_CHECK_FAILED", DELETE_CONFIRMED = "DELETE_CONFIRMED", DELETED = "DELETED", DELETE_FAILED = "DELETE_FAILED", DELETE_CANCELLED = "DELETE_CANCELLED"; //@formatter:on /** * Función que identifica si un evento no corresponde con el final de un ciclo * * @param eventType * tipo de evento * @return true si el tipo coincide con un evento final, false en caso contrario **/ protected static boolean isLocked(String eventType) { return !(eventType.equals(EventTypes.CREATED.toString()) || eventType.equals(EventTypes.UPDATED.toString()) || eventType.equals(EventTypes.CREATE_CANCELLED.toString()) || eventType.equals(EventTypes.UPDATE_CANCELLED.toString()) || eventType.equals(EventTypes.DELETE_CANCELLED.toString())); } /** * Función que identifica si un evento contiene el último estado correcto del * elemento * * @param eventType * tipo de evento * @return true si el tipo coincide con snapshot, false en caso contrario **/ protected static boolean isSnapshot(String eventType) { return (eventType.equals(EventTypes.CREATED.toString()) || eventType.equals(EventTypes.UPDATED.toString()) || eventType.equals(EventTypes.DELETED.toString())); } }