admin管理员组

文章数量:1127954

I should migrate from Spring Boot 2 to Spring Boot 3 and I had problems with kinesis. There is no error, the problem is that I do not receive the messages present in the stream. I think it could be a configuration problem but I do not know how to fix them. any answer will be appriciated

I have updated the dependencies as follow in my pom:

<parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>3.3.4</version>
        <relativePath/> <!-- lookup parent from repository -->
</parent>

...
<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-stream</artifactId>
    <version>4.1.4</version>
</dependency>

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

<dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>2024.0.0</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>io.awspring.cloud</groupId>
                <artifactId>spring-cloud-aws-dependencies</artifactId>
                <version>3.1.1</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

The code I was using was:

@Bean
public Consumer<String> authorization() {
    return message -> {
        log.info(message);
        // logic here
    };
}

properties:

spring:
  cloud:
    stream:
      function:
        definition: authorization
      bindings:
        authorization-in-0:
          destination: authorizationDestination
          group: authorization1

Everyting worked in the previous version because the configuration was based on convention name.
In particolar in order to create a consumer that receive message under the property "binding" you have to insert STREAM_NAME-in-0 and then create a bean with that stream name. In my case I have "authorization-in-0" and @Bean public Consumer<String> authorization() {...}.

You can find more information here:
.html
and here:

I tried different versions of the dependencies and @StreamListener is already deprecated so I would like to avoid to include something already deprecated.

本文标签: Spring Cloud Stream Kinesis Binder with Spring 3Stack Overflow