Spring Cloud Stream Germantown.M1 /2.2.0.M1 版本發佈公告

工程 | Oleg Zhurakousky | 2019 年 3 月 26 日 | ...

我們很高興宣佈 Spring Cloud Stream Germantown 版本系列的第一个里程碑版本 - Germantown.M1/2.2.0.M1。

Spring Cloud Stream Germantown 2.2.0.M1 可在 Spring Milestone 儲存庫中使用。

重點摘要

改進的首頁和使用者文件

請查看我們新的 首頁使用者指南

進一步的功能性程式設計增強

我們增加了額外的 功能性程式設計增強和簡化,您不再需要提供 @EnableBinding 註解,並且在某些情況下您可能不需要 `spring.cloud.stream.definition` 屬性。 考慮以下情況

@SpringBootApplication
public class SimpleFunctionRabbitDemoApplication {

    public static void main(String[] args) throws Exception {
        SpringApplication.run(SimpleFunctionRabbitDemoApplication.class);
    }

    @Bean
    public Function<String, String> echo() {
        return v -> v;
    }
}

在沒有任何額外屬性和/或註解的情況下,上述是一個功能完整的 Spring Cloud Stream 應用程式,基於框架能夠從上述程式碼中確定的內容,綁定為 Processor。 隨後,以下內容將綁定為 Sink

@SpringBootApplication
public class SimpleFunctionRabbitDemoApplication {

    public static void main(String[] args) throws Exception {
        SpringApplication.run(SimpleFunctionRabbitDemoApplication.class);
    }

    @Bean
    public Consumer<String> log() {
        return System.out::println;
    }
}

請注意,不再有 @EnableBinding 註解,也沒有 spring.cloud.stream.function.definition 屬性,因為框架能夠根據應用程式內容中只有一個可用的功能 Bean 來確定意圖。 如果有多個,和/或如果您想從多個 組合功能,您仍然可以提供 spring.cloud.stream.function.definition 屬性

功能性 Kafka Streams

秉持著我們在 Germantown 中推動的主題精神,Kafka Streams binder 現在也支援使用功能性程式設計模型編寫應用程式。 您可以簡單地定義 java.util.Function|Consumer 類型的 bean,而不是使用 StreamListenerSendTo 來組合您的處理器,binder 將委派給適當的綁定。 這個 功能仍在發展中 在 Kafka Streams binder 中,並關注此空間以了解更多改進、詳細資訊和範例應用程式,因為我們將通過 Germantown 的更多里程碑版本。

每个绑定的重试模板

能够配置 RetryTemplate 每个绑定.

许多 增强和错误修复

注意

如果应用程序是从 Spring Initializr 创建的,他们需要在 spring-cloud BOM 声明之前的 maven 依赖管理中添加此 BOM 片段,否则你最终会得到最新的快照

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

此外,请关注我们最新的 AWS Kinesis binder,它刚刚发布了 v1.1.0。

下一步

與往常一樣,我們歡迎回饋和貢獻,因此請透過 StackoverflowGitHub 或透過 Gitter 與我們聯繫。

取得 Spring 電子報

透過 Spring 電子報保持聯繫

訂閱

更上一層樓

VMware 提供培訓和認證,以加速您的進度。

了解更多

取得支援

Tanzu Spring 在一個簡單的訂閱中提供 OpenJDK™、Spring 和 Apache Tomcat® 的支援和二進位檔案。

了解更多

即將到來的活動

查看 Spring 社群中所有即將到來的活動。

檢視全部