如何将 gemfire 配置为 Spring 云数据流中聚合器模块的消息存储



链接 - https://github.com/spring-cloud-stream-app-starters/aggregator/tree/master/spring-cloud-starter-stream-processor-aggregator 不列出 gemfire 消息存储库的属性

GemfireMessageStore配置如下:

@ConditionalOnClass(GemfireMessageStore.class)
@ConditionalOnProperty(prefix = AggregatorProperties.PREFIX,
        name = "message-store-type",
        havingValue = AggregatorProperties.MessageStoreType.GEMFIRE)
@Import(ClientCacheAutoConfiguration.class)
static class Gemfire {
    @Bean
    @ConditionalOnMissingBean
    public ClientRegionFactoryBean<?, ?> gemfireRegion(GemFireCache cache, AggregatorProperties properties) {
        ClientRegionFactoryBean<?, ?> clientRegionFactoryBean = new ClientRegionFactoryBean<>();
        clientRegionFactoryBean.setCache(cache);
        clientRegionFactoryBean.setName(properties.getMessageStoreEntity());
        return clientRegionFactoryBean;
    }
    @Bean
    public MessageGroupStore messageStore(Region<Object, Object> region) {
        return new GemfireMessageStore(region);
    }
}

关键是你总是可以用你自己的ClientRegionFactoryBean覆盖那个。或者您可以考虑到ClientCacheAutoConfiguration是基于 @ClientCacheApplication ,这反过来又允许您拥有ClientCacheConfigurer Bean 并提供足以满足客户端缓存配置的任何内容。包括配置和池。没错:它不在应用程序启动器配置级别,您必须正确使用一些自定义代码作为依赖项包含在目标绑定器特定应用程序的最终 uber jar 中。

有关如何构建它们的详细信息,请参阅文档:https://docs.spring.io/spring-cloud-stream-app-starters/docs/Einstein.RC1/reference/htmlsingle/#_patching_pre_built_applications

通过 Spring 集成存在各种后端存储选项。您可以在 spring-cloud-starter-stream-processor-agreator/README 中阅读更多相关信息。

关于这个问题的Spring Integration文档作为链接包含在内,Gemfire部分可能会很有用。

查看MessageGroupStore实现也很有用,因为它是aggregator存储选项的基础。

最新更新