springspring-cloudspring-cloud-streamapache-pulsarspring-pulsar

Spring Pulsar: Missing spring-pulsar-spring-cloud-stream-binder dependency


Problem I'm setting up a Spring Boot application with Apache Pulsar integration using Spring Cloud Stream. When trying to build my project, I'm getting the following error:

auth-service:main: Could not find org.springframework.pulsar:spring-pulsar-spring-cloud-stream-binder:.
Required by:
    root project :

According to the official Spring Cloud Stream documentation for Pulsar, I should only need to include this dependency, but it seems the artifact cannot be found. It isn't presemt on mvnrepositories. My build.gradle.kts

kotlinplugins {
    kotlin("jvm") version "2.1.20"
    kotlin("plugin.spring") version "2.1.20"
    id("org.springframework.boot") version "3.4.5"
    id("io.spring.dependency-management") version "1.1.7"
    id("com.google.protobuf") version "0.9.5"
    kotlin("plugin.jpa") version "1.9.25"
}

// Other configuration...

dependencies {
    // Other dependencies...
    
    // Pulsar dependencies causing the issue
    implementation("org.springframework.pulsar:spring-pulsar-spring-boot-starter:0.2.0")
    implementation("org.springframework.boot:spring-boot-starter-pulsar-reactive")
    implementation("org.springframework.pulsar:spring-pulsar-spring-cloud-stream-binder")
    
    // Other dependencies...
}

extra["springCloudVersion"] = "2024.0.1"
extra["springGrpcVersion"] = "0.8.0"

dependencyManagement {
    imports {
        mavenBom("org.springframework.grpc:spring-grpc-dependencies:${property("springGrpcVersion")}")
        mavenBom("org.springframework.cloud:spring-cloud-dependencies:${property("springCloudVersion")}")
    }
}

What I've tried

Adding the dependency as shown in the documentation Checking Maven Central for this artifact Looking for version information in Spring documentation

Environment

Kotlin: 2.1.20 Spring Boot: 3.4.5 Spring Cloud: 2024.0.1 Spring Pulsar: 0.2.0

Question How can I properly configure the Spring Pulsar binder for Spring Cloud Stream? Does this dependency need a specific version number, or is there an alternative approach to integrate Pulsar with Spring Cloud Stream?

Edit - it works perfectly with kafka binder


Solution

  • Because you are using the Spring Cloud BOM you should not need to specify the Pulsar binder version as it brings in 4.2.1.

    The 0.2.0version was an experimental pre-GA version and does not work w/ Spring Boot 3.4.x.

    If you start your project from start.spring.io and choose "cloud stream" and "pulsar" dependencies ( example) you can see the pom.xml or build.gradle that is what you want.