Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -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()
}
}
32 changes: 30 additions & 2 deletions core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ compileJava {
}

group = 'com.p14n'
version = '1.2.0-SNAPSHOT'
version = '1.3.1-SNAPSHOT'

repositories {
mavenCentral()
Expand Down Expand Up @@ -88,4 +88,32 @@ configurations {

artifacts {
tests testJar
}
}

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'
}
}
}
32 changes: 30 additions & 2 deletions debezium/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ compileJava {
}

group = 'com.p14n'
version = '1.2.0-SNAPSHOT'
version = '1.3.1-SNAPSHOT'

repositories {
mavenCentral()
}

dependencies {
// Dependency on core module
implementation project(':core')
implementation project(':postevent-core')

// Debezium dependencies
implementation 'io.debezium:debezium-api:3.0.1.Final'
Expand Down Expand Up @@ -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'
}
}
}
30 changes: 11 additions & 19 deletions grpc/build.gradle
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -15,16 +15,16 @@ compileJava {
}

group = 'com.p14n'
version = '1.2.0-SNAPSHOT'
version = '1.3.1-SNAPSHOT'

repositories {
mavenCentral()
}

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'
Expand All @@ -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'
Expand Down Expand Up @@ -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 {
Expand All @@ -169,4 +161,4 @@ mavenPublishing {
url = 'https://github.com/p14n/postevent'
}
}
}
}
6 changes: 5 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
rootProject.name = 'postevent'
include 'core', 'debezium', 'grpc', 'vertx', 'app'
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'
24 changes: 12 additions & 12 deletions vertx/build.gradle
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -9,15 +15,16 @@ compileJava {
}

group = 'com.p14n'
version = '1.2.0-SNAPSHOT'
version = '1.3.1-SNAPSHOT'


repositories {
mavenCentral()
}

dependencies {
// Dependency on core module
implementation project(':core')
implementation project(':postevent-core')

// Vert.x dependencies
implementation 'io.vertx:vertx-core:5.0.4'
Expand Down Expand Up @@ -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 {
Expand All @@ -113,4 +113,4 @@ mavenPublishing {
url = 'https://github.com/p14n/postevent'
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
* <p>
* This server sets up the necessary infrastructure for event processing
* including database setup, message brokers, and catchup services.
* </p>
*/
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<AutoCloseable> closeables;
private AsyncExecutor asyncExecutor;
private final AsyncExecutor asyncExecutor;
OpenTelemetry ot;

/**
* Creates a new VertxConsumerServer.
*
* @param ds The DataSource for database operations
* @param asyncExecutor The async executor for handling operations
* @param ot The OpenTelemetry instance for observability
*/
public VertxConsumerServer(DataSource ds, AsyncExecutor asyncExecutor, OpenTelemetry ot) {
this.ds = ds;
this.asyncExecutor = asyncExecutor;
this.ot = ot;
}

public void start(EventBus eb, EventBusMessageBroker mb, Set<String> topics) throws IOException, InterruptedException {
/**
* Starts the consumer server with the specified configuration.
*
* @param eb The Vert.x EventBus to use for communication
* @param mb The EventBus message broker for event handling
* @param topics The set of topics to handle
* @throws IOException If database setup fails
* @throws InterruptedException If the operation is interrupted
*/
public void start(EventBus eb, EventBusMessageBroker mb, Set<String> topics)
throws IOException, InterruptedException {
logger.atInfo().log("Starting consumer server");

var db = new DatabaseSetup(ds);
db.setupServer(topics);
var catchupServer = new CatchupServer(ds);
var catchupService = new EventBusCatchupService(catchupServer,eb,topics,this.asyncExecutor);
var catchupService = new EventBusCatchupService(catchupServer, eb, topics, this.asyncExecutor);

closeables = List.of(catchupService, mb, asyncExecutor);
System.out.println("🌐 Vert.x EventBus server started");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Replace System.out.println with structured logging.

Switch to logger.atInfo().log(...) for improved consistency and observability.

Suggested change
System.out.println("🌐 Vert.x EventBus server started");
logger.atInfo().log("🌐 Vert.x EventBus server started");

Expand All @@ -45,11 +70,11 @@ public void start(EventBus eb, EventBusMessageBroker mb, Set<String> topics) thr

@Override
public void close() {
if(closeables != null){
for(var c : closeables){
if (closeables != null) {
for (var c : closeables) {
try {
c.close();
} catch (Exception e){
} catch (Exception e) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (bug_risk): Swallowing exceptions in close() may hide resource cleanup issues.

Logging exceptions in the catch block will help identify resource leaks and improve reliability.


}
}
Expand Down
Loading
Loading