我使用spring xd从原始表中获取数据并对其进行处理,然后将其存储到多个表中。
我成功地存储到一个表中。
我面临的问题是如何使用Spring XD sink 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
我想将处理过的数据存储到多个表中。
感谢。
答案 0 :(得分:1)
将结果发送到topic
个指定频道。创建两个(或更多)要从该主题使用的流 - 请参阅the documentation。
foo | bar > topic:result
topic:result > jdbc1
topic:result > jdbc2