0

Small question regarding SpringBoot + Spring Cloud Stream application please.

I have a pure consumer app based on SpringBoot and Spring Cloud Stream. It is a "only consuming messages from kafka consumer app", in has no http or rest endpoints to be exposed as part of its business logic.

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>org.example</groupId>
    <artifactId>streamreactiveconsumer</artifactId>
    <version>1.0-SNAPSHOT</version>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>3.0.2</version>
        <relativePath/>
    </parent>

    <properties>
        <maven.compiler.source>17</maven.compiler.source>
        <maven.compiler.target>17</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>2022.0.1</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-stream-binder-kafka</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
        <dependency>
            <groupId>io.micrometer</groupId>
            <artifactId>micrometer-registry-prometheus</artifactId>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project>

If you look at the dependency, the dependecy to spring cloud, to boot, to actuator are there. However, there is no dependency to neither webflux, neither web. The application is currently able to process all data.

As a plus, I would like to have the actuators endpoints as they are really useful to even a "just kafka messages consumer app".

Unfortunately, the current setup, even with actuator jar imported, the applicaiton does not expose the /actuator rest endpoint.

I was wondering, would it be possible to just expose actuator endpoints, without having to carry webflux or web please?

Thank you

invzbl3
  • 5,872
  • 9
  • 36
  • 76
PatPanda
  • 3,644
  • 9
  • 58
  • 154

1 Answers1

1

It is not clear what you mean; how do you expect the /actuator REST endpoint to be available without a web container such as Tomcat?

The actuator endpoints require spring web support (either type).

Gary Russell
  • 166,535
  • 14
  • 146
  • 179
  • this answer is correct. Even if for just two endpoints, we need to carry the whole webflux or web jar. Upvoted and accepted – PatPanda Feb 06 '23 at 18:46