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
4 changes: 4 additions & 0 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ If you want to build everything, use the `build` task:
== Modules
There are several modules in Spring Pulsar. Here is a quick overview:


=== spring-pulsar
The main library that provides the API to access Apache Pulsar.

Expand All @@ -71,6 +72,9 @@ Provides reference docs and handles aggregating javadocs.
=== spring-pulsar-spring-boot-autoconfigure
Provides Spring Boot auto-configuration for Spring Pulsar.

=== spring-pulsar-spring-boot-starter
Provides a dependency descriptor that can be included in your application to easily start using Spring Pulsar.

=== spring-pulsar-sample-apps
Provides sample applications to illustrate Spring Pulsar functionality as well as provide ability for quick manual verification during development.

Expand Down
4 changes: 3 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ check {
subprojects { subproject ->
task updateCopyrights {
onlyIf { gitPresent && !System.getenv('GITHUB_ACTION') }
inputs.files(modifiedFiles.filter { f -> f.path.contains(subproject.name) })
if (gitPresent) {
inputs.files(modifiedFiles.filter { f -> f.path.contains(subproject.name) })
}
outputs.dir('build')
doLast {
def now = Calendar.instance.get(Calendar.YEAR) as String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,9 @@ private void configureDependencyManagement(Project project) {
configurations
.matching((c) -> c.getName().endsWith("Classpath") || c.getName().toLowerCase().endsWith("annotationprocessor"))
.all((c) -> c.extendsFrom(dependencyManagement));
Dependency springBootParent = project.getDependencies().enforcedPlatform(project.getDependencies()
Dependency pulsarDependencies = project.getDependencies().enforcedPlatform(project.getDependencies()
.project(Collections.singletonMap("path", ":spring-pulsar-dependencies")));
dependencyManagement.getDependencies().add(springBootParent);
dependencyManagement.getDependencies().add(pulsarDependencies);
project.getPlugins().withType(OptionalDependenciesPlugin.class, (optionalDependencies) -> configurations
.getByName(OptionalDependenciesPlugin.OPTIONAL_CONFIGURATION_NAME).extendsFrom(dependencyManagement));
}
Expand Down
1 change: 1 addition & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@ rootProject.name = 'spring-pulsar-dist'
include 'spring-pulsar'
include 'spring-pulsar-dependencies'
include 'spring-pulsar-spring-boot-autoconfigure'
include 'spring-pulsar-spring-boot-starter'
include 'spring-pulsar-sample-apps'
include 'spring-pulsar-docs'
35 changes: 16 additions & 19 deletions spring-pulsar-dependencies/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,56 +7,53 @@ javaPlatform {
}

ext {
assertjVersion = '3.22.0'
assertjVersion = '3.23.1'
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

[UNRELATED] Went ahead and bumped versions in this PR

awaitilityVersion = '4.2.0'
googleJsr305Version = '3.0.2'
hamcrestVersion = '2.2'
hibernateValidationVersion = '7.0.4.Final'
jacksonBomVersion = '2.13.3'
jaywayJsonPathVersion = '2.6.0'
junitJupiterVersion = '5.8.2'
junitJupiterVersion = '5.9.0'
pulsarVersion = '2.10.0'
log4jVersion = '2.17.2'
mockitoVersion = '4.5.1'
log4jVersion = '2.18.0'
mockitoVersion = '4.6.1'
reactorVersion = '2020.0.17'
pulsarTestcontainersVersion = '1.17.2'
pulsarTestcontainersVersion = '1.17.3'
springBootVersion = '3.0.0-SNAPSHOT'
springRetryVersion = '1.3.3'
springVersion = '6.0.0-SNAPSHOT'
caffeineVersion = '3.1.1'
}

dependencies {
api platform("org.springframework:spring-framework-bom:$springVersion")
api platform("io.projectreactor:reactor-bom:$reactorVersion")
api platform("org.junit:junit-bom:$junitJupiterVersion")

api platform("com.fasterxml.jackson:jackson-bom:$jacksonBomVersion")
api platform("io.projectreactor:reactor-bom:$reactorVersion")
api platform("org.apache.logging.log4j:log4j-bom:$log4jVersion")
api platform("org.junit:junit-bom:$junitJupiterVersion")
api platform("org.mockito:mockito-bom:$mockitoVersion")
api platform("org.springframework:spring-framework-bom:$springVersion")

constraints {
// spring-pulsar
api "com.github.ben-manes.caffeine:caffeine:$caffeineVersion"
api "com.google.code.findbugs:jsr305:$googleJsr305Version"
api "com.jayway.jsonpath:json-path:$jaywayJsonPathVersion"
api "org.apache.pulsar:pulsar-client:$pulsarVersion"
api "org.apache.pulsar:pulsar-client-admin:$pulsarVersion"
api "org.apache.pulsar:pulsar-client-admin-api:$pulsarVersion"
api "org.springframework.retry:spring-retry:$springRetryVersion"
api "com.jayway.jsonpath:json-path:$jaywayJsonPathVersion"
api "org.mockito:mockito-junit-jupiter:$mockitoVersion"
api "org.assertj:assertj-core:$assertjVersion"
api "org.awaitility:awaitility:$awaitilityVersion"
api "org.hamcrest:hamcrest:$hamcrestVersion"
api "org.hibernate.validator:hibernate-validator:$hibernateValidationVersion"
// spring-pulsar-spring-boot-autoconfigure
api "org.springframework.boot:spring-boot-autoconfigure-processor:$springBootVersion"
api "org.springframework.boot:spring-boot-configuration-processor:$springBootVersion"
api "org.springframework.boot:spring-boot:$springBootVersion"
api "org.springframework.boot:spring-boot-autoconfigure:$springBootVersion"
api "org.springframework.boot:spring-boot-starter:$springBootVersion"
api "org.springframework.boot:spring-boot-starter-validation:$springBootVersion"
api "org.springframework.boot:spring-boot-starter-test:$springBootVersion"
// Common to all
api "com.google.code.findbugs:jsr305:$googleJsr305Version"
api 'org.apiguardian:apiguardian-api:1.0.0'
api "org.awaitility:awaitility:$awaitilityVersion"
api "org.hamcrest:hamcrest-core:$hamcrestVersion"
api "org.assertj:assertj-core:$assertjVersion"
api "org.springframework.retry:spring-retry:$springRetryVersion"
api "org.testcontainers:pulsar:$pulsarTestcontainersVersion"
}
}
2 changes: 1 addition & 1 deletion spring-pulsar-docs/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ configurations {
}

dependencies {
api 'org.springframework.boot:spring-boot-starter'
api project (':spring-pulsar')
api 'org.springframework.boot:spring-boot-starter'
configurationProperties(project(path: ":spring-pulsar-spring-boot-autoconfigure", configuration: "configurationPropertiesMetadata"))
}

Expand Down
40 changes: 40 additions & 0 deletions spring-pulsar-sample-apps/README.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
= Spring Pulsar Sample Applications

Sample applications that can be used to demonstrate and manually verify Spring Pulsar functionality.


[[build-apps]]
== Building
To build the applications simply execute the following command from the `spring-pulsar-sample-apps` directory:
[source,bash]
----
../gradlew clean build
----

[[run-apps]]
== Running

=== Pre-requisites
****
* The components have all been built by following the <<build-apps>> steps.
* Apache Pulsar standalone cluster available at `pulsar://localhost:6650`

TIP: The included link:../tools/pulsar/docker/README.adoc#_start_pulsar[Pulsar tools] can be used to easily start a standalone cluster locally on the required coordinates
****

=== Steps
Make sure the above pre-requisites are satisfied and that you are in the `spring-pulsar-sample-apps` directory and follow the steps below.

=== App1
To start the link:./src/main/java/app1/SpringPulsarBootApp.java[SpringPulsarBootApp] run the following command:
[source,bash]
----
../gradlew bootRun -PsampleMainClass='app1.SpringPulsarBootApp'
----

=== App2
To start the link:./src/main/java/app2/FailoverConsumerApp.java[FailoverConsumerApp] run the following command:
[source,bash]
----
../gradlew bootRun -PsampleMainClass='app2.FailoverConsumerApp'
----
12 changes: 11 additions & 1 deletion spring-pulsar-sample-apps/build.gradle
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
plugins {
id 'org.springframework.pulsar.spring-module'
id 'org.springframework.boot' version '2.7.2'
}

description = 'Spring Pulsar Sample Applications'

dependencies {
api project(':spring-pulsar-spring-boot-autoconfigure')
api project(':spring-pulsar-spring-boot-starter')
implementation 'com.google.code.findbugs:jsr305'
}

ext {
sampleMainClass = project.hasProperty("sampleMainClass") ?
project.getProperty("sampleMainClass") : "app1.SpringPulsarBootApp"
}

springBoot {
mainClass = sampleMainClass
}

project.afterEvaluate {
project.tasks.artifactoryPublish.enabled(false)
}
9 changes: 2 additions & 7 deletions spring-pulsar-spring-boot-autoconfigure/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,8 @@ dependencies {
api 'org.springframework.boot:spring-boot-starter-validation'
implementation 'com.google.code.findbugs:jsr305'

// TODO remove unused dependencies

// TODO do I really need this??? To avoid compiler warnings about @API annotations in JUnit code
testCompileOnly 'org.apiguardian:apiguardian-api'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.testcontainers:pulsar'
// TODO why do I care about these?
testRuntimeOnly 'org.apache.logging.log4j:log4j-core'
testRuntimeOnly 'org.apache.logging.log4j:log4j-jcl'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.testcontainers:pulsar'
}
9 changes: 9 additions & 0 deletions spring-pulsar-spring-boot-starter/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
plugins {
id 'org.springframework.pulsar.spring-module'
}

description = 'Spring Pulsar Spring Boot Starter'

dependencies {
api project (':spring-pulsar-spring-boot-autoconfigure')
}
34 changes: 10 additions & 24 deletions spring-pulsar/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,46 +5,32 @@ plugins {
description = 'Spring Pulsar Support'

dependencies {
api 'com.github.ben-manes.caffeine:caffeine'
api 'org.apache.pulsar:pulsar-client'
api 'org.apache.pulsar:pulsar-client-admin'
api 'org.apache.pulsar:pulsar-client-admin-api'
api 'org.springframework:spring-context'
api 'org.springframework:spring-messaging'
api 'org.springframework:spring-tx'
api ('org.springframework.retry:spring-retry') {
exclude group: 'org.springframework'
}
api 'org.apache.pulsar:pulsar-client'
api 'org.apache.pulsar:pulsar-client-admin'
api 'org.apache.pulsar:pulsar-client-admin-api'
api 'com.github.ben-manes.caffeine:caffeine'

implementation 'com.google.code.findbugs:jsr305'
optional 'com.fasterxml.jackson.core:jackson-core'
optional 'com.fasterxml.jackson.core:jackson-databind'
optional 'com.fasterxml.jackson.datatype:jackson-datatype-jdk8'
optional 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310'
optional 'com.fasterxml.jackson.datatype:jackson-datatype-joda'
optional 'com.jayway.jsonpath:json-path'
optional 'io.projectreactor:reactor-core'

testImplementation 'io.projectreactor:reactor-test'
testImplementation 'org.mockito:mockito-junit-jupiter'
testImplementation 'org.hibernate.validator:hibernate-validator'

// TODO remove unused dependencies

// Common to all ??
implementation 'com.google.code.findbugs:jsr305'
testImplementation 'org.junit.jupiter:junit-jupiter-api'
testImplementation 'org.junit.jupiter:junit-jupiter-params'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine'
testImplementation 'org.junit.jupiter:junit-jupiter'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
// To avoid compiler warnings about @API annotations in JUnit code
testCompileOnly 'org.apiguardian:apiguardian-api'
testRuntimeOnly 'org.apache.logging.log4j:log4j-core'
testRuntimeOnly 'org.apache.logging.log4j:log4j-jcl'
testImplementation("org.awaitility:awaitility") {
exclude group: 'org.hamcrest'
}
testImplementation 'org.hamcrest:hamcrest-core'
testImplementation 'org.assertj:assertj-core'
testImplementation 'org.testcontainers:pulsar'
testImplementation 'org.awaitility:awaitility'
testImplementation 'org.hamcrest:hamcrest'
testImplementation 'org.mockito:mockito-junit-jupiter'
testImplementation 'org.springframework:spring-test'
testImplementation 'org.testcontainers:pulsar'
}
2 changes: 1 addition & 1 deletion tools/pulsar/docker/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Runs a local standalone Pulsar cluster in Docker.
* The admin is available at `http://localhost:8080`
* Two Docker volumes (`pulsardata`, `pulsarconf`) are created to store the data, metadata, and configuration in order to not start "fresh" every time the container is restarted.


[#_start_pulsar]
==== Start
To start the cluster run the following script from project root dir:
[source,shell]
Expand Down