SpringBoot + Spring Cloud Stream: Expose /actuator/ endpoints to the web without webflux / web jars

huangapple go评论80阅读模式
英文:

SpringBoot + Spring Cloud Stream: Expose /actuator/ endpoints to the web without webflux / web jars

问题

关于SpringBootSpring Cloud Stream应用程序的小问题,请。

我有一个基于SpringBootSpring Cloud Stream的纯消费者应用程序。
它是一个"只从kafka消费者应用程序中消费消息",没有HTTP或rest端点作为其业务逻辑的一部分需要暴露。

如果您看一下依赖项,依赖于spring cloudboot,和actuator都存在。但是,没有依赖于webflux或web。该应用程序目前能够处理所有数据。

作为一个额外的要求,我希望能够暴露actuator端点,因为它们对于一个"只是kafka消息消费者应用程序"来说非常有用。

不幸的是,即使导入了actuator jar,当前的设置下,应用程序不会暴露/actuator REST端点。

我想知道是否有可能只暴露actuator端点,而不必使用webflux或web?谢谢!

英文:

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

答案1

得分: 1

不清楚您的意思;您希望 /actuator REST 端点在没有 Web 容器(如 Tomcat)的情况下可用吗?

actuator 端点需要 Spring Web 支持(任一类型)。

英文:

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).

huangapple
  • 本文由 发表于 2023年2月6日 17:42:45
  • 转载请务必保留本文链接:https://go.coder-hub.com/75359608.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定