diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..455be3d --- /dev/null +++ b/build.gradle @@ -0,0 +1,17 @@ +plugins { + id 'com.vanniktech.maven.publish' version '0.34.0' apply false +} + +subprojects { + + apply plugin: 'java-library' + apply plugin: 'com.vanniktech.maven.publish' + + group = 'test' + version = '1.0' + + mavenPublishing { + publishToMavenCentral(true) + signAllPublications() + } +} \ No newline at end of file diff --git a/core/build.gradle b/core/build.gradle index ed92d21..2ecc2f7 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -9,7 +9,7 @@ compileJava { } group = 'com.p14n' -version = '1.2.0-SNAPSHOT' +version = '1.3.1-SNAPSHOT' repositories { mavenCentral() @@ -88,4 +88,32 @@ configurations { artifacts { tests testJar -} \ No newline at end of file +} + +mavenPublishing { + + pom { + name = "Postevent Core" + description = 'A reliable event publishing and consumption system using PostgreSQL' + inceptionYear = "2025" + url = "https://github.com/p14n/postevent/" + licenses { + license { + name = 'MIT License' + url = 'https://opensource.org/licenses/MIT' + } + } + developers { + developer { + id = 'p14n' + name = 'Dean Chapman' + email = 'dean@p14n.com' + } + } + scm { + connection = 'scm:git:git://github.com/p14n/postevent.git' + developerConnection = 'scm:git:ssh://github.com:p14n/postevent.git' + url = 'https://github.com/p14n/postevent' + } + } +} diff --git a/debezium/build.gradle b/debezium/build.gradle index 0c0d708..022ee4d 100644 --- a/debezium/build.gradle +++ b/debezium/build.gradle @@ -9,7 +9,7 @@ compileJava { } group = 'com.p14n' -version = '1.2.0-SNAPSHOT' +version = '1.3.1-SNAPSHOT' repositories { mavenCentral() @@ -17,7 +17,7 @@ repositories { dependencies { // Dependency on core module - implementation project(':core') + implementation project(':postevent-core') // Debezium dependencies implementation 'io.debezium:debezium-api:3.0.1.Final' @@ -90,3 +90,31 @@ jar { tasks.withType(Jar) { duplicatesStrategy = DuplicatesStrategy.EXCLUDE } + +mavenPublishing { + + pom { + name = "Postevent Debezium" + description = 'A reliable event publishing and consumption system using PostgreSQL and Debezium' + inceptionYear = "2025" + url = "https://github.com/p14n/postevent/" + licenses { + license { + name = 'MIT License' + url = 'https://opensource.org/licenses/MIT' + } + } + developers { + developer { + id = 'p14n' + name = 'Dean Chapman' + email = 'dean@p14n.com' + } + } + scm { + connection = 'scm:git:git://github.com/p14n/postevent.git' + developerConnection = 'scm:git:ssh://github.com:p14n/postevent.git' + url = 'https://github.com/p14n/postevent' + } + } +} diff --git a/grpc/build.gradle b/grpc/build.gradle index c5fa77f..9cc1e21 100644 --- a/grpc/build.gradle +++ b/grpc/build.gradle @@ -1,12 +1,12 @@ -import com.vanniktech.maven.publish.SonatypeHost -import com.vanniktech.maven.publish.JavaLibrary -import com.vanniktech.maven.publish.JavadocJar +//import com.vanniktech.maven.publish.SonatypeHost +//import com.vanniktech.maven.publish.JavaLibrary +//import com.vanniktech.maven.publish.JavadocJar plugins { id 'java' id 'com.adarshr.test-logger' version '4.0.0' id 'com.google.protobuf' version '0.9.2' - id "com.vanniktech.maven.publish" version "0.31.0" + // id "com.vanniktech.maven.publish" version "0.31.0" } compileJava { @@ -15,7 +15,7 @@ compileJava { } group = 'com.p14n' -version = '1.2.0-SNAPSHOT' +version = '1.3.1-SNAPSHOT' repositories { mavenCentral() @@ -23,8 +23,8 @@ repositories { dependencies { // Dependency on core module - implementation project(':core') - implementation project(':debezium') + implementation project(':postevent-core') + implementation project(':postevent-debezium') // gRPC dependencies implementation 'io.grpc:grpc-netty-shaded:1.53.0' @@ -49,7 +49,7 @@ dependencies { implementation 'io.opentelemetry.instrumentation:opentelemetry-grpc-1.6:1.32.0-alpha' // Test dependencies - testImplementation project(path: ':core', configuration: 'tests') + testImplementation project(path: ':postevent-core', configuration: 'tests') testImplementation 'net.jqwik:jqwik:1.8.2' testImplementation platform('io.zonky.test.postgres:embedded-postgres-binaries-bom:16.2.0') testImplementation 'io.zonky.test:embedded-postgres:2.0.7' @@ -136,18 +136,10 @@ javadoc { } mavenPublishing { - - configure(new JavaLibrary(new JavadocJar.Javadoc(), true)) - publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL, true) - - signAllPublications() - - coordinates("com.p14n", "postevent", version) - pom { - name = "Postevent" - description = 'A reliable event publishing and consumption system using PostgreSQL and gRPC' + name = "Postevent gRPC" + description = 'A reliable event publishing and consumption system using PostgreSQL, Debezium and gRPC' inceptionYear = "2025" url = "https://github.com/p14n/postevent/" licenses { @@ -169,4 +161,4 @@ mavenPublishing { url = 'https://github.com/p14n/postevent' } } -} \ No newline at end of file +} diff --git a/settings.gradle b/settings.gradle index 04d7570..392ca36 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,2 +1,6 @@ rootProject.name = 'postevent' -include 'core', 'debezium', 'grpc', 'vertx', 'app' \ No newline at end of file +include 'core', 'debezium', 'grpc', 'vertx' +project(':core').name = 'postevent-core' +project(':debezium').name = 'postevent-debezium' +project(':grpc').name = 'postevent-grpc' +project(':vertx').name = 'postevent-vertx' \ No newline at end of file diff --git a/vertx/build.gradle b/vertx/build.gradle index 88b247a..7f5c248 100644 --- a/vertx/build.gradle +++ b/vertx/build.gradle @@ -1,6 +1,12 @@ + +//import com.vanniktech.maven.publish.SonatypeHost +//import com.vanniktech.maven.publish.JavaLibrary +//import com.vanniktech.maven.publish.JavadocJar + plugins { id 'java' id 'com.adarshr.test-logger' version '4.0.0' + //id "com.vanniktech.maven.publish" version "0.31.0" } compileJava { @@ -9,7 +15,8 @@ compileJava { } group = 'com.p14n' -version = '1.2.0-SNAPSHOT' +version = '1.3.1-SNAPSHOT' + repositories { mavenCentral() @@ -17,7 +24,7 @@ repositories { dependencies { // Dependency on core module - implementation project(':core') + implementation project(':postevent-core') // Vert.x dependencies implementation 'io.vertx:vertx-core:5.0.4' @@ -79,19 +86,12 @@ tasks.withType(Jar) { duplicatesStrategy = DuplicatesStrategy.EXCLUDE } -mavenPublishing { - - configure(new JavaLibrary(new JavadocJar.Javadoc(), true)) - publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL, true) - - signAllPublications() +mavenPublishing { - coordinates("com.p14n", "postevent-vertx", version) - pom { name = "Postevent Vert.x" - description = 'A reliable event publishing and consumption system using PostgreSQL and vert.x' + description = 'A reliable event publishing and consumption system using PostgreSQL and Vert.x EventBus' inceptionYear = "2025" url = "https://github.com/p14n/postevent/" licenses { @@ -113,4 +113,4 @@ mavenPublishing { url = 'https://github.com/p14n/postevent' } } -} \ No newline at end of file +} diff --git a/vertx/src/main/java/com/p14n/postevent/vertx/VertxConsumerServer.java b/vertx/src/main/java/com/p14n/postevent/vertx/VertxConsumerServer.java index 7740aac..53a64e5 100644 --- a/vertx/src/main/java/com/p14n/postevent/vertx/VertxConsumerServer.java +++ b/vertx/src/main/java/com/p14n/postevent/vertx/VertxConsumerServer.java @@ -15,28 +15,53 @@ import java.util.List; import java.util.Set; +/** + * Vert.x-based consumer server that provides event consumption capabilities + * using the EventBus for communication and coordination. + * + *
+ * This server sets up the necessary infrastructure for event processing + * including database setup, message brokers, and catchup services. + *
+ */ public class VertxConsumerServer implements AutoCloseable { private static final Logger logger = LoggerFactory.getLogger(VertxConsumerServer.class); - private DataSource ds; - //private ConfigData cfg; + private final DataSource ds; private List+ * This consumer handles persistent event processing with transactional + * guarantees + * and integrates with the Vert.x EventBus for distributed coordination. + *
+ */ public class VertxPersistentConsumer implements AutoCloseable, MessageBroker
* Example usage:
@@ -53,7 +52,10 @@
public class EventBusCatchupService implements AutoCloseable {
private static final Logger logger = LoggerFactory.getLogger(EventBusCatchupService.class);
+ /** EventBus address prefix for fetch events requests. */
public static final String FETCH_EVENTS_ADDRESS = "catchup.fetch_events.";
+
+ /** EventBus address prefix for get latest message ID requests. */
public static final String GET_LATEST_MESSAGE_ID_ADDRESS = "catchup.get_latest.";
private final CatchupServerInterface catchupServer;
@@ -68,11 +70,13 @@ public class EventBusCatchupService implements AutoCloseable {
*
* @param catchupServer The underlying catchup server implementation
* @param eventBus The Vert.x EventBus to use for messaging
+ * @param topics The set of topics to handle catchup requests for
+ * @param executor The async executor for handling requests
*/
public EventBusCatchupService(CatchupServerInterface catchupServer,
- EventBus eventBus,
- Set
* Subscribers receive events from the EventBus, providing low-latency
@@ -187,8 +186,8 @@ public void subscribeToEventBus(String topic, MessageSubscriber
* The codec uses JSON serialization for simplicity and debugging ease.
- * Events are encoded as JSON strings with a length prefix for efficient parsing.
+ * Events are encoded as JSON strings with a length prefix for efficient
+ * parsing.
*
@@ -24,6 +25,14 @@
*/
public class EventCodec implements MessageCodec