java - 如何通过 Spring XD Sink 处理一些数据并将其存储到多个表中

标签 java spring spring-xd

我正在使用 spring xd 从原始表中获取数据并对其进行处理,然后将其存储到多个表中。

我成功存储到一张表中。

我面临的问题是如何使用Spring XD接收器jdbc将数据存储到多个表。

目前我正在通过以下代码创建流。它将从原始表(raw_device_data)中获取数据,并在处理后将其存储到 sleep_analysis 表中。

stream create db --definition "source:jdbc --query='select data from raw_device_data where id=330' --url=jdbc:postgresql://localhost:5432/rahar --driverClassName=org.postgresql.Driver --username=postgres --password=root --outputType=application/json | customProcessor15 | sink:jdbc --tableName=sleep_analysis --initializeDatabase=true --columns=latency,sleep_duration,sleep_efficiency,total_minutes_in_bed,total_sleep_time,wakefulness --url=jdbc:postgresql://localhost:5432/rahar --driverClassName=org.postgresql.Driver --username=postgres --password=root"  --deploy

我想将处理后的数据存储到多个表中。

谢谢。

最佳答案

将结果发送到topic命名 channel 。创建两个(或更多)流以从该主题使用 - 请参阅the documentation .

foo | bar > topic:result

topic:result > jdbc1

topic:result > jdbc2

关于java - 如何通过 Spring XD Sink 处理一些数据并将其存储到多个表中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39617116/

相关文章:

java - SpringXD部署Stream时出错: StringDeserializer class could not be found

java - 如何在 OK-HTTP header 中添加非 ASCII 字符串?

java - 创建可能的对,而不管一组不定值中的顺序如何

java - 如何解决Spring Boot应用程序中的CORS问题?

java - PoolingHttpClientConnectionManager 不释放连接

java - 设置spring xd时发生非法反射访问操作

java - 用Jade开发的Agent系统一定是分布式的吗?

java - KDC - 我们从哪里获得服务器?

Java Webapp - 在哪里存储图像

apache-kafka - 如何将消息从kafka-sink路由到多个主题