Monday, 15 September 2014

Spring XD jdbc(source) -> jdbc(sink) -



Spring XD jdbc(source) -> jdbc(sink) -

i'm trying configure streams below (directly pipe jdbc source jdbc sink)

xd> stream create test2 --definition "output:jdbc --split=true --username=test --password=test --driverclassname=com.mysql.jdbc.driver --url=jdbc:mysql://dbhost:3306/test --query='select id,name test' | input:jdbc --username=test --password=test --driverclassname=com.mysql.jdbc.driver --tablename=test2 --columns=id,name --url=jdbc:mysql://dbhost:3306/test" --deploy

but occurs classcastexception.

caused by: java.lang.classcastexception: org.springframework.util.linkedcaseinsensitivemap cannot cast java.lang.string @ org.springframework.xd.jdbc.jdbcmessagepayloadtransformer.transformpayload(jdbcmessagepayloadtransformer.java:39) @ org.springframework.integration.transformer.abstractpayloadtransformer.dotransform(abstractpayloadtransformer.java:33) @ org.springframework.integration.transformer.abstracttransformer.transform(abstracttransformer.java:33) ... 147 more

mysql connection , table schema seems configured. connectivity confirmed.

create table test (id int, name varchar(20)); create table test2 (id int, name varchar(20))

spring xd version 1.1.0.build-20141103.163150-1-dist zip below.

http://repo.spring.io/libs-snapshot/org/springframework/xd/spring-xd/1.1.0.build-snapshot/spring-xd-1.1.0.build-20141103.163150-1-dist.zip

i want store payload info target sink table, functionality still experimental? or, stream problem, illustration racks kind of conversion?

like gary said, sink expects json document (there outstanding jira ticket improve sink take map). can have source produce json document instead of map using --outputtype=application/json. here illustration tried:

stream create jdbccp --definition "source:jdbc --query='select id,name,year myfiles status = 0' --maxrowsperpoll=10 --update='update myfiles set status = 1 id in (:id)' --outputtype=application/json | sink:jdbc --tablename=newfiles --columns=id,name,year" --deploy

the jira issue https://jira.spring.io/browse/xd-2250

jdbc spring-xd

No comments:

Post a Comment