I am experimenting with Spring Cloud Stream using the local Spring Cloud Dataflow server and the shell. I've gotten simple examples like this
dataflow:>stream create --name test --definition "time --trigger.time-unit=SECONDS | log" --deploy
working correctly, in that I see a message in the log once per second.
2017-08-09 12:51:30,602 INFO -kafka-listener-1 log-sink:202 - 08/09/17 12:51:30
2017-08-09 12:51:31,603 INFO -kafka-listener-1 log-sink:202 - 08/09/17 12:51:31
2017-08-09 12:51:32,605 INFO -kafka-listener-1 log-sink:202 - 08/09/17 12:51:32
.... more log msgs ....
Now I'm trying to expand this example to insert a transform. Instead of the time, I want to see 'hello world' in the log once per second, and I can't figure out how to specify the expression properly.
I've tried this:
dataflow:>stream create --name test --definition "time --trigger.time-unit=SECONDS | transform --transformer.expression='hello world' | log" --deploy
and this (note addition of '#{}'):
dataflow:>stream create --name test --definition "time --trigger.time-unit=SECONDS | transform --transformer.expression=#{'hello world'} | log" --deploy
But I continue to get an error in the transform log:
Failed to convert property value of type 'java.lang.String'
to required type 'org.springframework.expression.Expression' for
property 'expression'; nested exception is
org.springframework.core.convert.ConverterNotFoundException: No converter
found capable of converting from type [java.lang.String] to type
[org.springframework.expression.Expression]
I have read the Spring Expression Language docs (which I'm not finding helpful since the examples are all in terms of Java code). I've also looked at some of the Spring Cloud Stream test code for examples.
What am I missing?
Once I get 'hello world' working, I'd like to echo a property out of the local Dataflow Server's application.yml file too; suggestions welcome!
Update: I followed the quick-start docs for the 1.3.0.M1 milestone. The apps are loaded with
dataflow:>app import --uri http://bit-ly/Bacon-RELEASE-stream-applications-kafka-10-maven
just as documented. (Note, replaced bit.ly with bit-ly for purposes of this post since StackOverflow doesn't like bit.ly URLs.) When I hit the bit.ly URL directly in my browser and download the file, I see this:
source.file=maven://org.springframework.cloud.stream.app:file-source-kafka-10:1.2.0.RELEASE
source.file.metadata=maven://org.springframework.cloud.stream.app:file-source-kafka-10:jar:metadata:1.2.0.RELEASE
source.ftp=maven://org.springframework.cloud.stream.app:ftp-source-kafka-10:1.2.0.RELEASE
....
What URL should I use in order to download the 1.3.0.M1 apps? Is it a problem that the 1.2.0 apps don't appear to work with the 1.3.0.M1 server?
\"'hello'\"
or'''hello'''
. – Gary Russell'''hello'''
version and that works. I actually thought of and tried shell escaping but apparently didn't hit the right incantation. If you add this as an answer I'll accept it. For special chars like '?' do I just backslash them? – user944849