1

我正在使用 spring-xd-1.0.0.M6。

我尝试将 mysql DB 配置为 Spring-xd 的接收器

我关注 - http://theblasfrompas.blogspot.in/2014/01/springxd-filetail-input-ingestion-jdbc.html

我把我的 jdbc.properties 文件 - 在

1)spring-xd-1.0.0.M6/xd/modules/sink/jdbc/config 位置

2)我把mysql连接器罐子放在

spring-xd-1.0.0.M6/xd/lib

我创建一个文件 - input.txt 并将其放在文件夹中 -/<some path>/temp/input.txt

该文件包含

{"id":"1","name":"pas"}
{"id":"2","name":"lucia"}
{"id":"3","name":"lucas"}
{"id":"4","name":"siena"}

jdbc 文件包含以下信息。

driverClass=com.mysql.jdbc.Driver
url=jdbc:mysql://127.0.0.1:3306/spring_xd
username=root
password=root

现在在 XD shell 我执行以下

stream create --name filetest --definition "tail --name='/<some path>/temp/input.txt' |  jdbc --columns='id,name'" --deploy

我的 my-sql 数据库表名是 - file_test,它有 2 列 id 和 name - 与中提到的相同Example Link

但我明白了

Command failed org.springframework.xd.rest.client.impl.SpringXDException: Error with option(s) for module jdbc of type sink:
    columns: option named 'columns' is not supported

如果我指定 tableName 参数,我也会得到 ..

tableName: option named 'tableName' is not supported

我也参考 - https://github.com/spring-projects/spring-xd/pull/621

但线索少了....最新的 Spring-xd 版本

4

1 回答 1

0

您放置 .properties 文件的目录并不意味着配置模块,而是声明哪些选项可用。通过把它放在那里,您基本上已经声明该jdbc模块没有选项(因为您实际上没有使用正确的语法)。

相反,您需要将您提到的 .properties 文件放在其他地方。请注意,被拾取的确切位置在不同版本之间发生了变化。我建议使用最新版本(撰写本文时为 M7)。那么,正确的位置是

${xd.home}/config/modules/sink/jdbc/jdbc.properties

并不是

${xd.home}/modules/sink/jdbc/config/jdbc.properties   

请注意,XD 版本当前确实提供了这样一个开箱即用的文件,其内容如下所示:

url = ${spring.datasource.url}
driverClassName = ${spring.datasource.driverClassName}
username = ${spring.datasource.username}
password = ${spring.datasource.password}

这是为了让 jdbc 模块使用默认情况下定义server.yml的值

于 2014-06-16T13:46:07.780 回答