Reputation: 137
[![enter image description here][1]][1]I want to create streams using springXD. According to basic definition of streams, I have:
Source : http
Transform script : I written one groovy script which I stored at
/xd/modules/processor/script/transform.groovy
Sink : cassandra
I want to store the unstructured json data, which I posted from http to cassandra table. I run springXD on single-node mode, and then run xd-shell. For stream creation, I use:
stream create --name test2 --definition "http --port=9000 | transform --
script=insert_transform.groovy |cassandra --contactPoints=127.0.0.1 --
keyspace=db1 --ingestQuery='insert into table1 (emp_id,emp_name,amount,time)
values (?,?,?,?)'" –deploy
I got message: Created and deployed new stream 'test2'
After that when I am posting data through http it gives following errors:
500 INTERNAL_SERVER_ERROR
On the xd-singlenode, following error log appears:
Caused by: java.io.FileNotFoundException: class path resource [insert_transform.groovy] cannot be opened because it does not exist.
Upvotes: 1
Views: 101
Reputation: 174719
Which version of Spring XD? I just tested it with 1.3.0.RELEASE and it worked fine...
xd:>stream create foo --definition "time | transform --script=test.groovy | log" --deploy
.
$ cat xd/modules/processor/scripts/test.groovy
'Time = ' + payload
.
2016-01-11T09:45:19-0500 1.3.0.RELEASE INFO xdbus.foo.1-1 sink.foo - Time = 2016-01-11 09:45:19
2016-01-11T09:45:20-0500 1.3.0.RELEASE INFO xdbus.foo.1-1 sink.foo - Time = 2016-01-11 09:45:20
2016-01-11T09:45:21-0500 1.3.0.RELEASE INFO xdbus.foo.1-1 sink.foo - Time = 2016-01-11 09:45:21
Upvotes: 0