From 44f1cd1d49fc14eb63366d5fbc316253229039fc Mon Sep 17 00:00:00 2001 From: Carles Arnal Date: Tue, 8 Oct 2024 11:32:47 +0200 Subject: [PATCH] Add documentation to properties --- app/pom.xml | 4 ---- .../registry/events/ArtifactCreated.java | 1 - .../events/ArtifactMetadataUpdated.java | 1 - .../events/ArtifactRuleConfigured.java | 1 - .../events/ArtifactVersionCreated.java | 1 - .../ArtifactVersionMetadataUpdated.java | 1 - .../registry/events/GlobalRuleConfigured.java | 1 - .../registry/events/GroupCreated.java | 1 - .../registry/events/GroupDeleted.java | 1 - .../registry/events/GroupMetadataUpdated.java | 1 - .../registry/events/GroupRuleConfigured.java | 1 - .../impl/kafkasql/KafkaSqlFactory.java | 8 +++---- .../impl/sql/AbstractSqlRegistryStorage.java | 23 ++++++------------- .../ref-registry-all-configs.adoc | 6 ++--- pom.xml | 8 ------- 15 files changed, 14 insertions(+), 45 deletions(-) diff --git a/app/pom.xml b/app/pom.xml index 92b5d8bcba..7605313160 100644 --- a/app/pom.xml +++ b/app/pom.xml @@ -209,10 +209,6 @@ com.google.guava guava - - io.cloudevents - cloudevents-json-jackson - diff --git a/app/src/main/java/io/apicurio/registry/events/ArtifactCreated.java b/app/src/main/java/io/apicurio/registry/events/ArtifactCreated.java index fc98636c15..c0132035e4 100644 --- a/app/src/main/java/io/apicurio/registry/events/ArtifactCreated.java +++ b/app/src/main/java/io/apicurio/registry/events/ArtifactCreated.java @@ -18,7 +18,6 @@ private ArtifactCreated(String id, String aggregateId, JSONObject eventPayload) public static ArtifactCreated of(ArtifactMetaDataDto artifactMetaDataDto) { String id = UUID.randomUUID().toString(); - // TODO here we have to define the internal structure of the event, maybe use cloudevents? JSONObject jsonObject = new JSONObject(); jsonObject.put("id", id).put("groupId", artifactMetaDataDto.getGroupId()) .put("artifactId", artifactMetaDataDto.getArtifactId()) diff --git a/app/src/main/java/io/apicurio/registry/events/ArtifactMetadataUpdated.java b/app/src/main/java/io/apicurio/registry/events/ArtifactMetadataUpdated.java index 0e2f00ac16..93e68d925d 100644 --- a/app/src/main/java/io/apicurio/registry/events/ArtifactMetadataUpdated.java +++ b/app/src/main/java/io/apicurio/registry/events/ArtifactMetadataUpdated.java @@ -20,7 +20,6 @@ private ArtifactMetadataUpdated(String id, String aggregateId, JSONObject eventP public static ArtifactMetadataUpdated of(String groupId, String artifactId, EditableArtifactMetaDataDto artifactMetaDataDto) { String id = UUID.randomUUID().toString(); - // TODO here we have to define the internal structure of the event, maybe use cloudevents? JSONObject jsonObject = new JSONObject(); jsonObject.put("id", id).put("groupId", groupId).put("artifactId", artifactId) .put("name", artifactMetaDataDto.getName()).put("owner", artifactMetaDataDto.getOwner()) diff --git a/app/src/main/java/io/apicurio/registry/events/ArtifactRuleConfigured.java b/app/src/main/java/io/apicurio/registry/events/ArtifactRuleConfigured.java index 6a1d24f400..63443a6a6b 100644 --- a/app/src/main/java/io/apicurio/registry/events/ArtifactRuleConfigured.java +++ b/app/src/main/java/io/apicurio/registry/events/ArtifactRuleConfigured.java @@ -20,7 +20,6 @@ private ArtifactRuleConfigured(String id, String aggregateId, JSONObject eventPa public static ArtifactRuleConfigured of(String groupId, String artifactId, RuleType ruleType, RuleConfigurationDto rule) { String id = UUID.randomUUID().toString(); - // TODO here we have to define the internal structure of the event, maybe use cloudevents? JSONObject jsonObject = new JSONObject(); jsonObject.put("id", id).put("groupId", groupId).put("artifactId", artifactId) .put("ruleType", ruleType.value()).put("rule", rule.getConfiguration()) diff --git a/app/src/main/java/io/apicurio/registry/events/ArtifactVersionCreated.java b/app/src/main/java/io/apicurio/registry/events/ArtifactVersionCreated.java index 3d27d1401a..b861e1f044 100644 --- a/app/src/main/java/io/apicurio/registry/events/ArtifactVersionCreated.java +++ b/app/src/main/java/io/apicurio/registry/events/ArtifactVersionCreated.java @@ -18,7 +18,6 @@ private ArtifactVersionCreated(String id, String aggregateId, JSONObject eventPa public static ArtifactVersionCreated of(ArtifactVersionMetaDataDto versionMetaDataDto) { String id = UUID.randomUUID().toString(); - // TODO here we have to define the internal structure of the event, maybe use cloudevents? JSONObject jsonObject = new JSONObject(); jsonObject.put("id", id).put("groupId", versionMetaDataDto.getGroupId()) .put("artifactId", versionMetaDataDto.getArtifactId()) diff --git a/app/src/main/java/io/apicurio/registry/events/ArtifactVersionMetadataUpdated.java b/app/src/main/java/io/apicurio/registry/events/ArtifactVersionMetadataUpdated.java index c40f3ec67b..ee27ef3d0c 100644 --- a/app/src/main/java/io/apicurio/registry/events/ArtifactVersionMetadataUpdated.java +++ b/app/src/main/java/io/apicurio/registry/events/ArtifactVersionMetadataUpdated.java @@ -20,7 +20,6 @@ private ArtifactVersionMetadataUpdated(String id, String aggregateId, JSONObject public static ArtifactVersionMetadataUpdated of(String groupId, String artifactId, String version, EditableVersionMetaDataDto editableVersionMetaDataDto) { String id = UUID.randomUUID().toString(); - // TODO here we have to define the internal structure of the event, maybe use cloudevents? JSONObject jsonObject = new JSONObject(); jsonObject.put("id", id).put("groupId", groupId).put("artifactId", artifactId).put("version", version) .put("name", editableVersionMetaDataDto.getName()) diff --git a/app/src/main/java/io/apicurio/registry/events/GlobalRuleConfigured.java b/app/src/main/java/io/apicurio/registry/events/GlobalRuleConfigured.java index 1a0f1e77f2..e5a59a7150 100644 --- a/app/src/main/java/io/apicurio/registry/events/GlobalRuleConfigured.java +++ b/app/src/main/java/io/apicurio/registry/events/GlobalRuleConfigured.java @@ -19,7 +19,6 @@ private GlobalRuleConfigured(String id, String aggregateId, JSONObject eventPayl public static GlobalRuleConfigured of(RuleType ruleType, RuleConfigurationDto rule) { String id = UUID.randomUUID().toString(); - // TODO here we have to define the internal structure of the event, maybe use cloudevents? JSONObject jsonObject = new JSONObject(); jsonObject.put("id", id).put("ruleType", ruleType.value()).put("rule", rule.getConfiguration()) .put("eventType", GLOBAL_RULE_CONFIGURED.name()); diff --git a/app/src/main/java/io/apicurio/registry/events/GroupCreated.java b/app/src/main/java/io/apicurio/registry/events/GroupCreated.java index 3aba166ce2..d4992236d5 100644 --- a/app/src/main/java/io/apicurio/registry/events/GroupCreated.java +++ b/app/src/main/java/io/apicurio/registry/events/GroupCreated.java @@ -18,7 +18,6 @@ private GroupCreated(String id, String aggregateId, JSONObject eventPayload) { public static GroupCreated of(GroupMetaDataDto groupMetaDataDto) { String id = UUID.randomUUID().toString(); - // TODO here we have to define the internal structure of the event, maybe use cloudevents? JSONObject jsonObject = new JSONObject(); jsonObject.put("id", id).put("groupId", groupMetaDataDto.getGroupId()).put("eventType", GROUP_CREATED.name()); diff --git a/app/src/main/java/io/apicurio/registry/events/GroupDeleted.java b/app/src/main/java/io/apicurio/registry/events/GroupDeleted.java index 976ed68517..31c41a0967 100644 --- a/app/src/main/java/io/apicurio/registry/events/GroupDeleted.java +++ b/app/src/main/java/io/apicurio/registry/events/GroupDeleted.java @@ -17,7 +17,6 @@ private GroupDeleted(String id, String aggregateId, JSONObject eventPayload) { public static GroupDeleted of(String groupId) { String id = UUID.randomUUID().toString(); - // TODO here we have to define the internal structure of the event, maybe use cloudevents? JSONObject jsonObject = new JSONObject(); jsonObject.put("id", id).put("groupId", groupId).put("eventType", GROUP_DELETED.name()); diff --git a/app/src/main/java/io/apicurio/registry/events/GroupMetadataUpdated.java b/app/src/main/java/io/apicurio/registry/events/GroupMetadataUpdated.java index d896147671..75aefbb316 100644 --- a/app/src/main/java/io/apicurio/registry/events/GroupMetadataUpdated.java +++ b/app/src/main/java/io/apicurio/registry/events/GroupMetadataUpdated.java @@ -18,7 +18,6 @@ private GroupMetadataUpdated(String id, String aggregateId, JSONObject eventPayl public static GroupMetadataUpdated of(String groupId, EditableGroupMetaDataDto groupMetaDataDto) { String id = UUID.randomUUID().toString(); - // TODO here we have to define the internal structure of the event, maybe use cloudevents? JSONObject jsonObject = new JSONObject(); jsonObject.put("id", id).put("groupId", groupId).put("description", groupMetaDataDto.getDescription()) .put("eventType", GROUP_METADATA_UPDATED.name()); diff --git a/app/src/main/java/io/apicurio/registry/events/GroupRuleConfigured.java b/app/src/main/java/io/apicurio/registry/events/GroupRuleConfigured.java index 5c56ceb8bd..d26b0466e2 100644 --- a/app/src/main/java/io/apicurio/registry/events/GroupRuleConfigured.java +++ b/app/src/main/java/io/apicurio/registry/events/GroupRuleConfigured.java @@ -19,7 +19,6 @@ private GroupRuleConfigured(String id, String aggregateId, JSONObject eventPaylo public static GroupRuleConfigured of(String groupId, RuleType ruleType, RuleConfigurationDto rule) { String id = UUID.randomUUID().toString(); - // TODO here we have to define the internal structure of the event, maybe use cloudevents? JSONObject jsonObject = new JSONObject(); jsonObject.put("id", id).put("groupId", groupId).put("ruleType", ruleType.value()) .put("rule", rule.getConfiguration()).put("eventType", GROUP_RULE_CONFIGURED.name()); diff --git a/app/src/main/java/io/apicurio/registry/storage/impl/kafkasql/KafkaSqlFactory.java b/app/src/main/java/io/apicurio/registry/storage/impl/kafkasql/KafkaSqlFactory.java index 8951dc67b5..ee668db677 100644 --- a/app/src/main/java/io/apicurio/registry/storage/impl/kafkasql/KafkaSqlFactory.java +++ b/app/src/main/java/io/apicurio/registry/storage/impl/kafkasql/KafkaSqlFactory.java @@ -41,22 +41,22 @@ public class KafkaSqlFactory { @Inject @ConfigProperty(name = "apicurio.kafkasql.snapshots.topic", defaultValue = "kafkasql-snapshots") - @Info(category = "storage", description = "Kafka sql storage topic name") + @Info(category = "storage", description = "Kafka sql storage topic name", registryAvailableSince = "3.0.0") String snapshotsTopic; @Inject @ConfigProperty(name = "apicurio.kafkasql.snapshot.every.seconds", defaultValue = "86400s") - @Info(category = "storage", description = "Kafka sql journal topic snapshot every") + @Info(category = "storage", description = "Kafka sql journal topic snapshot every", registryAvailableSince = "3.0.0") String snapshotEvery; @Inject @ConfigProperty(name = "apicurio.storage.snapshot.location", defaultValue = "./") - @Info(category = "storage", description = "Kafka sql snapshots store location") + @Info(category = "storage", description = "Kafka sql snapshots store location", registryAvailableSince = "3.0.0") String snapshotStoreLocation; @Inject @ConfigProperty(name = "apicurio.events.kafka.topic", defaultValue = "registry-events") - @Info(category = "storage", description = "Kafka sql storage event topic") + @Info(category = "storage", description = "Kafka sql storage event topic", registryAvailableSince = "3.0.1") String eventsTopic; @Inject diff --git a/app/src/main/java/io/apicurio/registry/storage/impl/sql/AbstractSqlRegistryStorage.java b/app/src/main/java/io/apicurio/registry/storage/impl/sql/AbstractSqlRegistryStorage.java index e9fd0b7f67..08b7518549 100644 --- a/app/src/main/java/io/apicurio/registry/storage/impl/sql/AbstractSqlRegistryStorage.java +++ b/app/src/main/java/io/apicurio/registry/storage/impl/sql/AbstractSqlRegistryStorage.java @@ -3587,12 +3587,14 @@ public String createSnapshot(String location) throws RegistryStorageException { public String createEvent(OutboxEvent event) { if (supportsDatabaseEvents()) { // Create outbox event - handles.withHandle(handle -> handle.createUpdate(sqlStatements.createOutboxEvent()) - .bind(0, event.getId()).bind(1, eventsTopic).bind(2, event.getAggregateId()) - .bind(3, event.getType()).bind(4, event.getPayload().toString()).execute()); - - deleteEvent(event.getId()); + handles.withHandle(handle -> { + handle.createUpdate(sqlStatements.createOutboxEvent()).bind(0, event.getId()) + .bind(1, eventsTopic).bind(2, event.getAggregateId()).bind(3, event.getType()) + .bind(4, event.getPayload().toString()).execute(); + return handle.createUpdate(sqlStatements.deleteOutboxEvent()).bind(0, event.getId()) + .execute(); + }); } return event.getId(); } @@ -3602,17 +3604,6 @@ public boolean supportsDatabaseEvents() { return isPostgresql() || isMssql(); } - private void deleteEvent(String eventId) { - try { - handles.withHandle(handle -> handle.createUpdate(sqlStatements.deleteOutboxEvent()) - .bind(0, eventId).execute()); - } - - catch (RegistryStorageException ex) { - throw new RegistryStorageException("Could not delete outbox event with ID " + eventId + ".", ex); - } - } - private boolean isPostgresql() { return sqlStatements.dbType().equals("postgresql"); } diff --git a/docs/modules/ROOT/partials/getting-started/ref-registry-all-configs.adoc b/docs/modules/ROOT/partials/getting-started/ref-registry-all-configs.adoc index f4c32179ed..d517ffa076 100644 --- a/docs/modules/ROOT/partials/getting-started/ref-registry-all-configs.adoc +++ b/docs/modules/ROOT/partials/getting-started/ref-registry-all-configs.adoc @@ -778,12 +778,12 @@ The following {registry} configuration options are available for each component |`apicurio.kafkasql.snapshot.every.seconds` |`string` |`86400s` -| +|`3.0.0` |Kafka sql journal topic snapshot every |`apicurio.kafkasql.snapshots.topic` |`string` |`kafkasql-snapshots` -| +|`3.0.0` |Kafka sql storage topic name |`apicurio.kafkasql.ssl.key.password` |`optional` @@ -838,7 +838,7 @@ The following {registry} configuration options are available for each component |`apicurio.storage.snapshot.location` |`string` |`./` -| +|`3.0.0` |Kafka sql snapshots store location |`apicurio.storage.sql.kind` |`string` diff --git a/pom.xml b/pom.xml index bfca76d207..9be5f5120b 100644 --- a/pom.xml +++ b/pom.xml @@ -173,9 +173,6 @@ 4.6.3 - - 4.0.1 - 7.6.2 @@ -633,11 +630,6 @@ ${lombok.version} provided - - io.cloudevents - cloudevents-json-jackson - ${cloudevents.version} - org.apache.santuario xmlsec